{"record":{"id":"71d05329ea78352a","repo":"thanos-io/thanos","slug":"not-supported-index-file-version-d-of-s","errorCode":null,"errorMessage":"not supported index file version %d of %s","messagePattern":"not supported index file version (.+?) of (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/block/indexheader/binary_reader.go","lineNumber":210,"sourceCode":"\n\tb, err := io.ReadAll(rc)\n\tif err != nil {\n\t\trunutil.CloseWithErrCapture(&err, rc, \"close reader\")\n\t\treturn nil, 0, errors.Wrapf(err, \"get header from object storage of %s\", indexFilepath)\n\t}\n\n\tif err := rc.Close(); err != nil {\n\t\treturn nil, 0, errors.Wrap(err, \"close reader\")\n\t}\n\n\tif m := binary.BigEndian.Uint32(b[0:4]); m != index.MagicIndex {\n\t\treturn nil, 0, errors.Errorf(\"invalid magic number %x for %s\", m, indexFilepath)\n\t}\n\n\tversion := int(b[4:5][0])\n\n\tif version != index.FormatV1 && version != index.FormatV2 {\n\t\treturn nil, 0, errors.Errorf(\"not supported index file version %d of %s\", version, indexFilepath)\n\t}\n\n\tir := &chunkedIndexReader{\n\t\tctx:  ctx,\n\t\tpath: indexFilepath,\n\t\tsize: uint64(attrs.Size),\n\t\tbkt:  bkt,\n\t}\n\n\ttoc, err := ir.readTOC()\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\tir.toc = toc\n\n\treturn ir, version, nil\n}\n","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/block/indexheader/binary_reader.go#L192-L228","documentation":"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.","triggerScenarios":"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.","commonSituations":"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+.","solutions":["Check the version byte (byte offset 4) of the index file; if >2, upgrade Thanos to a release supporting that Prometheus index format.","Downgrade/re-export the block: re-compact or re-write the index with a Prometheus version producing format v1/v2.","Confirm the block's meta.json (thanos.version / prometheus version) to identify what wrote the index and whether your Thanos is compatible.","If the file is randomly corrupt, replace the block from a healthy replica or backup."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"rc, _ := bkt.GetRange(ctx, path, 4, 1)\nb, _ := io.ReadAll(rc)\nv := int(b[0])\nif v != index.FormatV1 && v != index.FormatV2 {\n    return fmt.Errorf(\"index version %d unsupported by this Thanos build; upgrade\", v)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep Thanos upgraded to match the Prometheus version writing your blocks.","Check meta.json (thanos/compile versions) of new blocks before serving them.","Pin the block-producing Prometheus version in your compactor/producer pipeline."],"tags":["versioning","compatibility","index-header","thanos"],"backgroundTag":"unsupported-operation","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}