{"record":{"id":"123b4ffe938a46f4","repo":"thanos-io/thanos","slug":"download-index-file-s","errorCode":null,"errorMessage":"download index file %s","messagePattern":"download index file (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/verifier/index_issue.go","lineNumber":134,"sourceCode":"\t\treturn errors.Wrapf(err, \"repaired block is invalid %s\", resid)\n\t}\n\n\tlevel.Info(ctx.Logger).Log(\"msg\", \"uploading repaired block\", \"newID\", resid)\n\tif err = block.Upload(ctx, ctx.Logger, ctx.Bkt, filepath.Join(dir, resid.String()), metadata.NoneFunc); err != nil {\n\t\treturn errors.Wrapf(err, \"upload of %s failed\", resid)\n\t}\n\n\tlevel.Info(ctx.Logger).Log(\"msg\", \"safe deleting broken block\", \"id\", id, \"issue\")\n\tif err := BackupAndDeleteDownloaded(ctx, filepath.Join(dir, id.String()), id); err != nil {\n\t\treturn errors.Wrapf(err, \"safe deleting old block %s failed\", id)\n\t}\n\n\treturn nil\n}\n\nfunc verifyIndex(ctx Context, id ulid.ULID, dir string, meta *metadata.Meta) (stats block.HealthStats, err error) {\n\tif err := objstore.DownloadFile(ctx, ctx.Logger, ctx.Bkt, path.Join(id.String(), block.IndexFilename), filepath.Join(dir, block.IndexFilename)); err != nil {\n\t\treturn stats, errors.Wrapf(err, \"download index file %s\", path.Join(id.String(), block.IndexFilename))\n\t}\n\n\tstats, err = block.GatherIndexHealthStats(ctx, ctx.Logger, filepath.Join(dir, block.IndexFilename), meta.MinTime, meta.MaxTime)\n\tif err != nil {\n\t\treturn stats, errors.Wrapf(err, \"gather index issues %s\", id)\n\t}\n\n\tlevel.Debug(ctx.Logger).Log(\"stats\", fmt.Sprintf(\"%+v\", stats), \"id\", id)\n\n\treturn stats, stats.AnyErr()\n}\n","sourceCodeStart":116,"sourceCodeEnd":146,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/verifier/index_issue.go#L116-L146","documentation":"verifyIndex downloads the block's index file from the bucket with objstore.DownloadFile; failure is wrapped as \"download index file %s\" (object key \"<ULID>/index\"). This is the read path used when verifying (not repairing) a block's index health.","triggerScenarios":"DownloadFile fails because the index object does not exist in the bucket (missing block files), the object key is wrong, the object store is unreachable, credentials lack GetObject permission, or the network drops mid-transfer.","commonSituations":"Block partially uploaded/deleted in the bucket (missing index object -> NoSuchKey); wrong objstore config pointing at the wrong bucket/prefix; expired credentials; rate limiting from the object store.","solutions":["Check the wrapped cause: NoSuchKey means the block is incomplete in the bucket — inspect the block's meta.json/objects.","Verify objstore config points to the intended bucket.","Test GetObject access with the same credentials.","Retry on transient network errors; enable client retries in the objstore config.","If the block is genuinely incomplete, restore it from backup or delete/mark it for compaction."],"exampleFix":"// before: incomplete block in bucket (missing index object)\n// cause: s3 NoSuchKey <ulid>/index\n// after: restore block from backup then verify again\n$ thanos tools bucket verify --objstore.config-file=s3.yaml --id=<ulid>","handlingStrategy":"try-catch","validationCode":"// check the index object exists before verification\nok, err := bkt.Exists(ctx, path.Join(id.String(), \"index\"))\nif err != nil || !ok { return fmt.Errorf(\"block %s incomplete: no index object\", id) }","typeGuard":null,"tryCatchPattern":"if err := verify.VerifyIssue(ctx, ...); err != nil {\n    if strings.Contains(err.Error(), \"download index file\") {\n        // if wrapped error is NoSuchKey, mark block incomplete / restore from backup\n    }\n}","preventionTips":["Verify objstore config points to the right bucket and prefix","Use credentials with GetObject on all block objects","Enable client-side retries for transient object-store errors"],"tags":["go","object-storage","download","index","thanos"],"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"}