thanos-io/thanos · error

not supported index file version

Error message

not supported index file version %d of %s

What it means

After validating the magic number, newChunkedIndexReader reads the 5th byte of the index file as the index format version. Only FormatV1 and FormatV2 Prometheus index versions are supported; anything else fails with this error. It protects the binary reader from parsing index layouts it does not understand.

Solutions

  1. Check the version byte (byte offset 4) of the index file; if >2, upgrade Thanos to a release supporting that Prometheus index format.
  2. Downgrade/re-export the block: re-compact or re-write the index with a Prometheus version producing format v1/v2.
  3. Confirm the block's meta.json (thanos.version / prometheus version) to identify what wrote the index and whether your Thanos is compatible.
  4. If the file is randomly corrupt, replace the block from a healthy replica or backup.
Defensive patterns

Strategy: validation

Validate before calling

rc, _ := bkt.GetRange(ctx, path, 4, 1)
b, _ := io.ReadAll(rc)
v := int(b[0])
if v != index.FormatV1 && v != index.FormatV2 {
    return fmt.Errorf("index version %d unsupported by this Thanos build; upgrade", v)
}

Prevention

When it happens

Trigger: WriteBinary -> newChunkedIndexReader encountering an index file whose version byte is not 1 or 2 — e.g. an index produced by a newer Prometheus/Thanos format, or arbitrary bytes that happened to pass magic check on a corrupt file.

Common situations: Blocks written by a newer Prometheus than the Thanos build supports; custom or experimental index formats; corrupt files where only the magic was intact; running an old Thanos against freshly compacted blocks with format v3+.

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


AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07). Data as JSON: /api/errors/71d05329ea78352a. Report an issue: GitHub.

Appendix: source

Thrown at pkg/block/indexheader/binary_reader.go:210

	b, err := io.ReadAll(rc)
	if err != nil {
		runutil.CloseWithErrCapture(&err, rc, "close reader")
		return nil, 0, errors.Wrapf(err, "get header from object storage of %s", indexFilepath)
	}

	if err := rc.Close(); err != nil {
		return nil, 0, errors.Wrap(err, "close reader")
	}

	if m := binary.BigEndian.Uint32(b[0:4]); m != index.MagicIndex {
		return nil, 0, errors.Errorf("invalid magic number %x for %s", m, indexFilepath)
	}

	version := int(b[4:5][0])

	if version != index.FormatV1 && version != index.FormatV2 {
		return nil, 0, errors.Errorf("not supported index file version %d of %s", version, indexFilepath)
	}

	ir := &chunkedIndexReader{
		ctx:  ctx,
		path: indexFilepath,
		size: uint64(attrs.Size),
		bkt:  bkt,
	}

	toc, err := ir.readTOC()
	if err != nil {
		return nil, 0, err
	}
	ir.toc = toc

	return ir, version, nil
}

View on GitHub (pinned to 35b8b99117)