dgraph-io/badger · error
MANIFEST file has invalid manifestChange op
Error message
MANIFEST file has invalid manifestChange op
What it means
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.
Source
Thrown at manifest.go:458
for len(build.Levels) <= int(tc.Level) {
build.Levels = append(build.Levels, levelManifest{make(map[uint64]struct{})})
}
build.Levels[tc.Level].Tables[tc.Id] = struct{}{}
build.Creations++
case pb.ManifestChange_DELETE:
tm, ok := build.Tables[tc.Id]
if !ok {
opt.Warningf("MANIFEST delete: table %d has already been removed", tc.Id)
for _, level := range build.Levels {
delete(level.Tables, tc.Id)
}
} else {
delete(build.Levels[tm.Level].Tables, tc.Id)
delete(build.Tables, tc.Id)
}
build.Deletions++
default:
return fmt.Errorf("MANIFEST file has invalid manifestChange op")
}
return nil
}
// This is not a "recoverable" error -- opening the KV store fails because the MANIFEST file is
// just plain broken.
func applyChangeSet(build *Manifest, changeSet *pb.ManifestChangeSet, opt Options) error {
for _, change := range changeSet.Changes {
if err := applyManifestChange(build, change, opt); err != nil {
return err
}
}
return nil
}
func newCreateChange(
id uint64, level int, keyID uint64, c options.CompressionType) *pb.ManifestChange {
return &pb.ManifestChange{View on GitHub (pinned to 2a001d466f)
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
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at manifest.go:458 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of dgraph-io/badger@2a001d466f (2026-09-05).
Data as JSON: /api/errors/c37fa8c7cf2f32d2.
Report an issue: GitHub.