{"record":{"id":"6c971371c4941b1b","repo":"thanos-io/thanos","slug":"create-index-header-reader","errorCode":null,"errorMessage":"create index header reader","messagePattern":"create index header reader","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/store/bucket.go","lineNumber":874,"sourceCode":"\t\t\ts.metrics.blockLoadDuration.Observe(time.Since(start).Seconds())\n\t\t}\n\t}()\n\ts.metrics.blockLoads.Inc()\n\n\tlset := labels.FromMap(meta.Thanos.Labels)\n\th := lset.Hash()\n\n\tindexHeaderReader, err := s.indexReaderPool.NewBinaryReader(\n\t\tctx,\n\t\ts.logger,\n\t\ts.bkt,\n\t\ts.dir,\n\t\tmeta.ULID,\n\t\ts.postingOffsetsInMemSampling,\n\t\tmeta,\n\t)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"create index header reader\")\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\trunutil.CloseWithErrCapture(&err, indexHeaderReader, \"index-header\")\n\t\t}\n\t}()\n\n\tb, err := newBucketBlock(\n\t\tctx,\n\t\ts.metrics,\n\t\tmeta,\n\t\ts.bkt,\n\t\tdir,\n\t\ts.indexCache,\n\t\ts.chunkPool,\n\t\tindexHeaderReader,\n\t\ts.partitioner,\n\t\ts.blockEstimatedMaxSeriesFunc,","sourceCodeStart":856,"sourceCodeEnd":892,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/store/bucket.go#L856-L892","documentation":"When syncing a single block, BucketStore builds an index-header reader via indexheader.NewReader (wrapped with \"create index header reader\"). Failures come from downloading/parsing the block's meta or index-header file from object storage, or from the underlying bucket reader.","triggerScenarios":"Syncing a block whose index-header (or index) object is missing, corrupt, or fails checksum; bucket GetObject errors; or binary-format version mismatch between the writer and reader of index-header files.","commonSituations":"Partially uploaded blocks in the bucket, Thanos version upgrade changing index-header format while old blocks lack header files, or transient object-storage errors during startup.","solutions":["Run `thanos tools bucket verify` to identify and mark/remove the corrupt block.","Delete/re-upload the affected block so meta.json and index-header files are complete.","Check bucket credentials and network access for GetObject on the block prefix.","Upgrade all Thanos components to the same version to avoid index-header format mismatches."],"exampleFix":"// before\n// opaque failure: create index header reader: ...\n// after\nif err := store.InitialSync(ctx); err != nil {\n    logger.Error(\"block sync failed; run `thanos tools bucket verify` to find corrupt blocks\", \"err\", err)\n    return err\n}","handlingStrategy":"retry","validationCode":"if err := verifyBlockObjects(ctx, bkt, meta.ULID); err != nil {\n    return errors.Wrapf(err, \"block %s objects incomplete\", meta.ULID)\n}","typeGuard":null,"tryCatchPattern":"if err := syncBlock(ctx, meta); err != nil {\n    if isTransient(err) { return retryWithBackoff(ctx, func() error { return syncBlock(ctx, meta) }) }\n    return errors.Wrapf(err, \"block %s may be corrupt; run bucket verify\", meta.ULID)\n}","preventionTips":["Ensure uploads are atomic (multi-object upload with commit)","Keep all Thanos components on the same version","Schedule periodic `thanos tools bucket verify` runs"],"tags":["thanos","object-storage","index-header"],"backgroundTag":"resource-not-found","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"}