{"record":{"id":"8b9000ce005dd440","repo":"dgraph-io/badger","slug":"unsupported-compression-type-8b9000","errorCode":null,"errorMessage":"Unsupported compression type","messagePattern":"Unsupported compression type","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"table/table.go","lineNumber":851,"sourceCode":"\t\tif err != nil {\n\t\t\tz.Free(dst)\n\t\t\treturn y.Wrap(err, \"failed to decompress\")\n\t\t}\n\tcase options.ZSTD:\n\t\tsz := int(float64(t.opt.BlockSize) * 1.2)\n\t\t// Get frame content size from header.\n\t\tvar hdr zstd.Header\n\t\tif err := hdr.Decode(b.data); err == nil && hdr.HasFCS && hdr.FrameContentSize < uint64(t.opt.BlockSize*2) {\n\t\t\tsz = int(hdr.FrameContentSize)\n\t\t}\n\t\tdst = z.Calloc(sz, \"Table.Decompress\")\n\t\tb.data, err = y.ZSTDDecompress(dst, b.data)\n\t\tif err != nil {\n\t\t\tz.Free(dst)\n\t\t\treturn y.Wrap(err, \"failed to decompress\")\n\t\t}\n\tdefault:\n\t\treturn errors.New(\"Unsupported compression type\")\n\t}\n\n\tif b.freeMe {\n\t\tz.Free(src)\n\t\tb.freeMe = false\n\t}\n\n\tif len(b.data) > 0 && len(dst) > 0 && &dst[0] != &b.data[0] {\n\t\tz.Free(dst)\n\t} else {\n\t\tb.freeMe = true\n\t}\n\treturn nil\n}\n","sourceCodeStart":833,"sourceCodeEnd":866,"githubUrl":"https://github.com/dgraph-io/badger/blob/2a001d466f6b71a917319a1db41f99860e16e269/table/table.go#L833-L866","documentation":"Block decompression switches on the table's configured compression algorithm; the default case means the algorithm value stored in the table options is not one of the supported types (zstd or snappy), so Badger cannot decompress the block.","triggerScenarios":"Reading a block whose table was created with a compression enum value unknown to this Badger build — files written by a newer Badger version with a compression type this binary doesn't support, or a corrupted option byte.","commonSituations":"Downgrading Badger after tables were written with a newer compression option; copying SSTs from a v3/newer deployment into an older version's directory; binary-level corruption of table metadata.","solutions":["Use a Badger version that supports the compression type the tables were written with (upgrade)","Rebuild the data directory by exporting with the old/new writer and importing with your binary: db.Backup + db.Load","Do not copy SST files across Badger major versions; always migrate via export/import","If only one table is affected, quarantine it and restore from backup"],"exampleFix":"// before: copying v4 sst files into a v2 badger data dir\n\n// after: migrate data through the API\noldDB.Backup(w, 0)\nnewDB.Load(r, maxPendingWrites) // newDB built with a version supporting the compression","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"db, err := badger.Open(opt)\nif err != nil && strings.Contains(err.Error(), \"Unsupported compression type\") {\n    // upgrade badger to a version supporting the table's compression\n    // or migrate data via Backup/Load from a compatible binary\n}","preventionTips":["Never downgrade Badger on an existing data directory without migrating","Migrate across versions using db.Backup + db.Load, never raw file copies","Pin Badger versions consistently across all services sharing a data dir"],"tags":["compression","version-mismatch","data-corruption","storage"],"backgroundTag":"unsupported-compression-type","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"}