kopia/kopia · error · errLZ4NotSupported

LZ4 compressor is not supported in recent versions of…

Error message

LZ4 compressor is not supported in recent versions of kopia, version v0.22.3 or older is needed to read legacy repositories that use the LZ4 compressor

What it means

errLZ4NotSupported indicates the LZ4 compressor was removed from Kopia. The stub lz4Compressor returns it from both Compress and Decompress; reading legacy LZ4 repositories requires Kopia v0.22.3 or older.

Solutions

  1. Re-compress the repository contents with a supported algorithm using Kopia v0.22.3 or older before upgrading
  2. Use Kopia v0.22.3 or older to access legacy LZ4 data
  3. Change compression settings for new data to a supported algorithm (e.g. zstd)
Defensive patterns

Strategy: fallback

Validate before calling

if comp.HeaderID() == compression.HeaderIDForAlgorithm("lz4") {
    return errors.New("lz4 compression is not supported by this kopia version")
}

Try / catch

if err := compressor.Compress(w, r); err != nil {
    if strings.Contains(err.Error(), "LZ4 compressor is not supported") {
        return migrateLegacyRepository() // use kopia <= v0.22.3
    }
    return err
}

Prevention

When it happens

Trigger: Reading a repository whose format lists the 'lz4' compression algorithm (headerLZ4Removed) with a modern Kopia version; decompressing LZ4-compressed content.

Common situations: Upgrading an old Kopia repository that used lz4 compression and then trying to read old compressed content with the new binary.

Understand the failure class

Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.

Related errors


AI-assisted analysis of kopia/kopia@82495e54b5 (2026-09-07). Data as JSON: /api/errors/52602c37da241eff. Report an issue: GitHub.

Appendix: source

Thrown at repo/compression/compressor_lz4.go:12

package compression

import (
	"errors"
	"io"
)

func init() {
	registerUnsupportedCompressor("lz4", lz4Compressor{})
}

var errLZ4NotSupported = errors.New("LZ4 compressor is not supported in recent versions of kopia, version v0.22.3 or older is needed to read legacy repositories that use the LZ4 compressor")

type lz4Compressor struct{}

func (c lz4Compressor) HeaderID() HeaderID {
	return headerLZ4Removed
}

func (c lz4Compressor) Compress(_ io.Writer, _ io.Reader) error {
	return errLZ4NotSupported
}

func (c lz4Compressor) Decompress(_ io.Writer, _ io.Reader, _ bool) error {
	return errLZ4NotSupported
}

View on GitHub (pinned to 82495e54b5)