{"record":{"id":"1cdda4d2804e7a3b","repo":"kopia/kopia","slug":"compression-not-supported-in-index-v1","errorCode":null,"errorMessage":"compression not supported in index v1","messagePattern":"compression not supported in index v1","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"repo/content/index/index_v1.go","lineNumber":351,"sourceCode":"\t\t}\n\t}\n\n\tb.extraDataOffset = uint32(v1HeaderSize + b.entryCount*(b.keyLength+b.entryLength)) //nolint:gosec\n\n\treturn extraData\n}\n\nfunc (b *indexBuilderV1) writeEntry(w io.Writer, it *Info, entry []byte) error {\n\tvar hashBuf [maxContentIDSize]byte\n\n\tk := contentIDToBytes(hashBuf[:0], it.ContentID)\n\n\tif len(k) != b.keyLength {\n\t\treturn errors.Errorf(\"inconsistent key length: %v vs %v\", len(k), b.keyLength)\n\t}\n\n\tif it.CompressionHeaderID != 0 {\n\t\treturn errors.New(\"compression not supported in index v1\")\n\t}\n\n\tif it.EncryptionKeyID != 0 {\n\t\treturn errors.New(\"encryption key ID not supported in index v1\")\n\t}\n\n\tif err := b.formatEntry(entry, it); err != nil {\n\t\treturn errors.Wrap(err, \"unable to format entry\")\n\t}\n\n\tif _, err := w.Write(k); err != nil {\n\t\treturn errors.Wrap(err, \"error writing entry key\")\n\t}\n\n\tif _, err := w.Write(entry); err != nil {\n\t\treturn errors.Wrap(err, \"error writing entry\")\n\t}\n","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/kopia/kopia/blob/82495e54b584c1ef6073c9e1be048f57f8aef078/repo/content/index/index_v1.go#L333-L369","documentation":"writeEntry refuses to write entries that carry a compression header ID into an index v1 file, because the v1 on-disk format predates per-entry compression and has no field to store it. It is raised during buildV1 when any indexed entry's CompressionHeaderID is non-zero. Repos with compression enabled must use index v2 or later.","triggerScenarios":"Building an index v1 (via buildV1 -> writeEntry) while the repository/content manager has compression enabled, so entry.CompressionHeaderID != 0.","commonSituations":"A repository configured with a compressor (e.g. zstd) but still writing or downgrading to index v1; migration of an old repo where compression was later enabled; tooling that forces legacy index format output.","solutions":["Disable compression in the repository settings or use the default index format (v2+) that supports compression.","Remove or re-create compressed content before writing a v1 index.","Upgrade tooling so indexes are written in v2 format instead of v1."],"exampleFix":"// before\nrepoOpts := repo.NewParameters()\nrepoOpts.IndexVersion = 1\nrepoOpts.Compressor = compression.HeaderZstd\n// after\nrepoOpts.IndexVersion = 2 // v2 indexes support compression\nrepoOpts.Compressor = compression.HeaderZstd","handlingStrategy":"validation","validationCode":"// Go: verify no entry carries a compression header before v1 write\nfor _, e := range entries {\n\tif e.CompressionHeaderID != 0 {\n\t\treturn errors.New(\"entry compressed; index v1 unsupported — use v2\")\n\t}\n}","typeGuard":"func isV1CompressionSafe(e ContentEntry) bool { return e.CompressionHeaderID == 0 }","tryCatchPattern":"idx, err := index.WriteIndex(ctx, out, b)\nif err != nil && strings.Contains(err.Error(), \"compression not supported in index v1\") {\n\t// rebuild with index v2 instead\n}","preventionTips":["Don't pair index version 1 with a configured compressor.","Check repo parameters (index version vs compressor) at config load time.","Prefer index v2 for any repo using compression."],"tags":["index","compression","format-limitation"],"backgroundTag":"unsupported-operation","analyzedSha":"82495e54b584c1ef6073c9e1be048f57f8aef078","analyzedAt":"2026-09-07T20:35:21.689Z","contentChangedAt":"2026-09-07T20:35:21.689Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}