{"record":{"id":"e8009e96640c50f5","repo":"dgraph-io/badger","slug":"errinvaliddump","errorCode":"ErrInvalidDump","errorMessage":"Data dump cannot be read","messagePattern":"Data dump cannot be read","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"errors.go","lineNumber":76,"sourceCode":"\t// ErrRejected is returned if a value log GC is called either while another GC is running, or\n\t// after DB::Close has been called.\n\tErrRejected = stderrors.New(\"Value log GC request rejected\")\n\n\t// ErrInvalidRequest is returned if the user request is invalid.\n\tErrInvalidRequest = stderrors.New(\"Invalid request\")\n\n\t// ErrManagedTxn is returned if the user tries to use an API which isn't\n\t// allowed due to external management of transactions, when using ManagedDB.\n\tErrManagedTxn = stderrors.New(\n\t\t\"Invalid API request. Not allowed to perform this action using ManagedDB\")\n\n\t// ErrNamespaceMode is returned if the user tries to use an API which is allowed only when\n\t// NamespaceOffset is non-negative.\n\tErrNamespaceMode = stderrors.New(\n\t\t\"Invalid API request. Not allowed to perform this action when NamespaceMode is not set.\")\n\n\t// ErrInvalidDump if a data dump made previously cannot be loaded into the database.\n\tErrInvalidDump = stderrors.New(\"Data dump cannot be read\")\n\n\t// ErrZeroBandwidth is returned if the user passes in zero bandwidth for sequence.\n\tErrZeroBandwidth = stderrors.New(\"Bandwidth must be greater than zero\")\n\n\t// ErrWindowsNotSupported is returned when opt.ReadOnly is used on Windows\n\tErrWindowsNotSupported = stderrors.New(\"Read-only mode is not supported on Windows\")\n\n\t// ErrPlan9NotSupported is returned when opt.ReadOnly is used on Plan 9\n\tErrPlan9NotSupported = stderrors.New(\"Read-only mode is not supported on Plan 9\")\n\n\t// ErrTruncateNeeded is returned when the value log gets corrupt, and requires truncation of\n\t// corrupt data to allow Badger to run properly.\n\tErrTruncateNeeded = stderrors.New(\n\t\t\"Log truncate required to run DB. This might result in data loss\")\n\n\t// ErrBlockedWrites is returned if the user called DropAll. During the process of dropping all\n\t// data from Badger, we stop accepting new writes, by returning this error.\n\tErrBlockedWrites = stderrors.New(\"Writes are blocked, possibly due to DropAll or Close\")","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/dgraph-io/badger/blob/2a001d466f6b71a917319a1db41f99860e16e269/errors.go#L58-L94","documentation":"ErrInvalidDump is returned when a previously made data dump (from DB.Dump / stream writer output) cannot be loaded into the database via DB.Load. The dump file is missing, truncated, or corrupted so its entries cannot be replayed. Defined in errors.go as a sentinel error.","triggerScenarios":"Calling db.Load(r) with a reader over a corrupt/incomplete dump file, or loading a dump whose format/version does not match the current Badger.","commonSituations":"Restoring backups across Badger versions; dumps truncated by interrupted writes or failed network transfers; piping the wrong file into Load.","solutions":["Regenerate the dump with db.Dump from a healthy DB and retry Load","Verify the dump file size and integrity (checksum) before loading","Ensure the producing and consuming Badger versions have compatible dump formats","Use KVList version-prefixed format checks / stream writer for cross-version migration"],"exampleFix":"// before\nf, _ := os.Open(\"backup.dump\")\ndb.Load(f, maxPendingWrites)\n// after\nfi, err := os.Stat(\"backup.dump\")\nif err != nil || fi.Size() == 0 {\n\treturn fmt.Errorf(\"dump missing or empty: %w\", err)\n}\nf, _ := os.Open(\"backup.dump\")\nif err := db.Load(f, maxPendingWrites); err != nil {\n\treturn fmt.Errorf(\"dump unreadable, regenerate backup: %w\", err)\n}","handlingStrategy":"validation","validationCode":"fi, err := os.Stat(dumpPath); if err != nil || fi.Size() == 0 { return fmt.Errorf(\"dump missing/empty\") }","typeGuard":"func isInvalidDump(err error) bool { return errors.Is(err, ErrInvalidDump) }","tryCatchPattern":"if err := db.Load(dumpFile, 16); err != nil {\n\tif errors.Is(err, ErrInvalidDump) {\n\t\t// regenerate dump or restore from alternate backup\n\t}\n}","preventionTips":["Checksum dumps at creation and verify before Load","Keep multiple backup generations","Test restore procedures periodically, not only backups"],"tags":["badger","backup","restore","data-corruption"],"backgroundTag":"corrupt-dump-file","analyzedSha":"2a001d466f6b71a917319a1db41f99860e16e269","analyzedAt":"2026-09-05T13:00:02.264Z","contentChangedAt":"2026-09-05T13:00:02.264Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}