{"record":{"id":"c37fa8c7cf2f32d2","repo":"dgraph-io/badger","slug":"manifest-file-has-invalid-manifestchange-op","errorCode":null,"errorMessage":"MANIFEST file has invalid manifestChange op","messagePattern":"MANIFEST file has invalid manifestChange op","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"manifest.go","lineNumber":458,"sourceCode":"\t\tfor len(build.Levels) <= int(tc.Level) {\n\t\t\tbuild.Levels = append(build.Levels, levelManifest{make(map[uint64]struct{})})\n\t\t}\n\t\tbuild.Levels[tc.Level].Tables[tc.Id] = struct{}{}\n\t\tbuild.Creations++\n\tcase pb.ManifestChange_DELETE:\n\t\ttm, ok := build.Tables[tc.Id]\n\t\tif !ok {\n\t\t\topt.Warningf(\"MANIFEST delete: table %d has already been removed\", tc.Id)\n\t\t\tfor _, level := range build.Levels {\n\t\t\t\tdelete(level.Tables, tc.Id)\n\t\t\t}\n\t\t} else {\n\t\t\tdelete(build.Levels[tm.Level].Tables, tc.Id)\n\t\t\tdelete(build.Tables, tc.Id)\n\t\t}\n\t\tbuild.Deletions++\n\tdefault:\n\t\treturn fmt.Errorf(\"MANIFEST file has invalid manifestChange op\")\n\t}\n\treturn nil\n}\n\n// This is not a \"recoverable\" error -- opening the KV store fails because the MANIFEST file is\n// just plain broken.\nfunc applyChangeSet(build *Manifest, changeSet *pb.ManifestChangeSet, opt Options) error {\n\tfor _, change := range changeSet.Changes {\n\t\tif err := applyManifestChange(build, change, opt); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc newCreateChange(\n\tid uint64, level int, keyID uint64, c options.CompressionType) *pb.ManifestChange {\n\treturn &pb.ManifestChange{","sourceCodeStart":440,"sourceCodeEnd":476,"githubUrl":"https://github.com/dgraph-io/badger/blob/2a001d466f6b71a917319a1db41f99860e16e269/manifest.go#L440-L476","documentation":"Returned by applyManifestChange when a decoded ManifestChange carries an op field that is neither CREATE nor DELETE. Because the value comes from a proto-unmarshalled byte buffer, an unknown op means the buffer was interpreted incorrectly or the file was written by an incompatible Badger version with new op codes the reader does not know. The default branch of the switch treats this as fatal corruption of the MANIFEST stream.","triggerScenarios":"Thrown at manifest.go:458 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the reading binary uses the same or newer badger/v4 version than the one that wrote the MANIFEST; upgrade the dependency and retry","Restore the MANIFEST from backup if it may be corrupted","If the trailing blocks are damaged, truncate the MANIFEST to the last consistent change set","Recreate the database from an export if the file cannot be read by any available version"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}