dgraph-io/badger · error
MANIFEST invalid, table %d exists
Error message
MANIFEST invalid, table %d exists
What it means
Returned by applyManifestChange while replaying or applying a ManifestChange of op CREATE: the table ID being created already exists in the in-memory Tables map. A valid MANIFEST never creates the same table ID twice, so encountering a duplicate CREATE means the change log is internally inconsistent — either file corruption or a replay of stale changes — and Badger aborts opening rather than build a corrupt LSM view.
Source
Thrown at manifest.go:433
var changeSet pb.ManifestChangeSet
if err := proto.Unmarshal(buf, &changeSet); err != nil {
return Manifest{}, 0, err
}
if err := applyChangeSet(&build, &changeSet, opt); err != nil {
return Manifest{}, 0, err
}
}
return build, offset, nil
}
func applyManifestChange(build *Manifest, tc *pb.ManifestChange, opt Options) error {
switch tc.Op {
case pb.ManifestChange_CREATE:
if _, ok := build.Tables[tc.Id]; ok {
return fmt.Errorf("MANIFEST invalid, table %d exists", tc.Id)
}
build.Tables[tc.Id] = TableManifest{
Level: uint8(tc.Level),
KeyID: tc.KeyId,
Compression: options.CompressionType(tc.Compression),
}
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)
}View on GitHub (pinned to 2a001d466f)
Solutions
- Restore the MANIFEST (and the database directory) from a known-good backup
- If the duplicate entry is in a trailing corrupt block, truncate the MANIFEST at the previous valid change set per the troubleshooting guide
- Verify disk health, as duplicated change records typically stem from corruption or torn writes
- Otherwise drop the directory and rebuild the database from an export/backup
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at manifest.go:433 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/ed6951a30c3f578e.
Report an issue: GitHub.