kopia/kopia · error
compression not supported in index v1
Error message
compression not supported in index v1
What it means
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.
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.
Example fix
// before repoOpts := repo.NewParameters() repoOpts.IndexVersion = 1 repoOpts.Compressor = compression.HeaderZstd // after repoOpts.IndexVersion = 2 // v2 indexes support compression repoOpts.Compressor = compression.HeaderZstd
Defensive patterns
Strategy: validation
Validate before calling
// Go: verify no entry carries a compression header before v1 write
for _, e := range entries {
if e.CompressionHeaderID != 0 {
return errors.New("entry compressed; index v1 unsupported — use v2")
}
} Type guard
func isV1CompressionSafe(e ContentEntry) bool { return e.CompressionHeaderID == 0 } Try / catch
idx, err := index.WriteIndex(ctx, out, b)
if err != nil && strings.Contains(err.Error(), "compression not supported in index v1") {
// rebuild with index v2 instead
} Prevention
- 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.
When it happens
Trigger: Building an index v1 (via buildV1 -> writeEntry) while the repository/content manager has compression enabled, so entry.CompressionHeaderID != 0.
Common situations: 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.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- encryption key ID not supported in index v1
- unsupported compressor
- unsupported - too many index v2 format infos
- closing index shards
- CompactEpoch
AI-assisted analysis of kopia/kopia@82495e54b5 (2026-09-07).
Data as JSON: /api/errors/1cdda4d2804e7a3b.
Report an issue: GitHub.
Appendix: source
Thrown at repo/content/index/index_v1.go:351
}
}
b.extraDataOffset = uint32(v1HeaderSize + b.entryCount*(b.keyLength+b.entryLength)) //nolint:gosec
return extraData
}
func (b *indexBuilderV1) writeEntry(w io.Writer, it *Info, entry []byte) error {
var hashBuf [maxContentIDSize]byte
k := contentIDToBytes(hashBuf[:0], it.ContentID)
if len(k) != b.keyLength {
return errors.Errorf("inconsistent key length: %v vs %v", len(k), b.keyLength)
}
if it.CompressionHeaderID != 0 {
return errors.New("compression not supported in index v1")
}
if it.EncryptionKeyID != 0 {
return errors.New("encryption key ID not supported in index v1")
}
if err := b.formatEntry(entry, it); err != nil {
return errors.Wrap(err, "unable to format entry")
}
if _, err := w.Write(k); err != nil {
return errors.Wrap(err, "error writing entry key")
}
if _, err := w.Write(entry); err != nil {
return errors.Wrap(err, "error writing entry")
}
View on GitHub (pinned to 82495e54b5)