Skip to content

Troubles restoring a dump #174

@reamasesa

Description

@reamasesa

Hi,

Using version 2.0.28, I tried restoring a backup by triggering the on demand URL and got these errors

mgob  | time="2025-12-14T12:48:26Z" level=info msg="On demand restore started from /storage/dbName/dbName-1765670580.gz" plan=dbName
mgob  | time="2025-12-14T12:48:26Z" level=debug msg="Running restore for plan dbName, backupPath /storage/dbName/dbName-1765670580.gz" plan=dbName
mgob  | time="2025-12-14T12:48:26Z" level=info msg="Running restore command with : mongorestore --archive=/storage/dbName/dbName-1765670580.gz --gzip --host mongo --port 27017 -u \"${MONGODB_ADMIN_USERNAME}\" -p \"${MONGODB_ADMIN_PASSWORD}\" --nsInclude dbName.* --authenticationDatabase admin " plan=dbName
mgob  | 2025/12/14 12:48:26 "POST http://localhost:8090/restore/dbName/dbName-1765670580.gz HTTP/1.1" from 172.23.0.1:44870 - 000 0B in 477.034µs
mgob  |
mgob  |  panic: runtime error: invalid memory address or nil pointer dereference
mgob  |
mgob  |  -> github.com/stefanprodan/mgob/pkg/backup.RunRestore
mgob  |  ->   /go/src/github.com/stefanprodan/mgob/pkg/backup/validate.go:90
mgob  |
mgob  |     github.com/stefanprodan/mgob/pkg/restore.Run
mgob  |       /go/src/github.com/stefanprodan/mgob/pkg/restore/restore.go:33
mgob  |     github.com/stefanprodan/mgob/pkg/api.postRestore
mgob  |       /go/src/github.com/stefanprodan/mgob/pkg/api/restore.go:33
mgob  |     net/http.HandlerFunc.ServeHTTP
mgob  |       /usr/local/go/src/net/http/server.go:2141
mgob  |     github.com/go-chi/chi/v5.(*Mux).routeHTTP
mgob  |       /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:444
mgob  |     net/http.HandlerFunc.ServeHTTP
mgob  |       /usr/local/go/src/net/http/server.go:2141
mgob  |     github.com/stefanprodan/mgob/pkg/api.(*HttpServer).Start.func4.configCtx.func1.1
mgob  |       /go/src/github.com/stefanprodan/mgob/pkg/api/server.go:86
mgob  |     net/http.HandlerFunc.ServeHTTP
mgob  |       /usr/local/go/src/net/http/server.go:2141
mgob  |     github.com/go-chi/chi/v5.(*Mux).ServeHTTP
mgob  |       /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:73
mgob  |     github.com/go-chi/chi/v5.(*Mux).Mount.func1
mgob  |       /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:316
mgob  |     net/http.HandlerFunc.ServeHTTP
mgob  |       /usr/local/go/src/net/http/server.go:2141
mgob  |     github.com/go-chi/chi/v5.(*Mux).routeHTTP
mgob  |       /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:444
mgob  |     net/http.HandlerFunc.ServeHTTP
mgob  |       /usr/local/go/src/net/http/server.go:2141
mgob  |     github.com/go-chi/chi/v5/middleware.init.0.RequestLogger.func1.1
mgob  |       /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/middleware/logger.go:54
mgob  |     net/http.HandlerFunc.ServeHTTP
mgob  |       /usr/local/go/src/net/http/server.go:2141
mgob  |     github.com/go-chi/chi/v5/middleware.Recoverer.func1
mgob  |       /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/middleware/recoverer.go:45
mgob  |     net/http.HandlerFunc.ServeHTTP
mgob  |       /usr/local/go/src/net/http/server.go:2141
mgob  |     github.com/go-chi/chi/v5.(*Mux).ServeHTTP
mgob  |       /go/pkg/mod/github.com/go-chi/chi/v5@v5.0.10/mux.go:90
mgob  |     net/http.serverHandler.ServeHTTP
mgob  |       /usr/local/go/src/net/http/server.go:2943
mgob  |     net/http.(*conn).serve
mgob  |       /usr/local/go/src/net/http/server.go:2014
mgob  |     created by net/http.(*Server).Serve in goroutine 11
mgob  |       /usr/local/go/src/net/http/server.go:3091

[REMOVED SNIPPET]

Please advise
Thanks

[EDIT]
Since this was during an upgrade and I was stressed out, I forgot to add the --archive= flag, eventually I remembered and was able to manually restore my DB

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions