{"record":{"id":"b51ea7a32ccc6f4d","repo":"thanos-io/thanos","slug":"list-chunk-files","errorCode":null,"errorMessage":"list chunk files","messagePattern":"list chunk files","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/store/bucket.go","lineNumber":2500,"sourceCode":"\t\testimatedMaxChunkSize:  maxChunkSize,\n\t}\n\n\t// Get object handles for all chunk files (segment files) from meta.json, if available.\n\tif len(meta.Thanos.SegmentFiles) > 0 {\n\t\tb.chunkObjs = make([]string, 0, len(meta.Thanos.SegmentFiles))\n\n\t\tfor _, sf := range meta.Thanos.SegmentFiles {\n\t\t\tb.chunkObjs = append(b.chunkObjs, path.Join(meta.ULID.String(), block.ChunksDirname, sf))\n\t\t}\n\t\treturn b, nil\n\t}\n\n\t// Get object handles for all chunk files from storage.\n\tif err = bkt.Iter(ctx, path.Join(meta.ULID.String(), block.ChunksDirname), func(n string) error {\n\t\tb.chunkObjs = append(b.chunkObjs, n)\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, errors.Wrap(err, \"list chunk files\")\n\t}\n\treturn b, nil\n}\n\nfunc (b *bucketBlock) indexFilename() string {\n\treturn path.Join(b.meta.ULID.String(), block.IndexFilename)\n}\n\nfunc (b *bucketBlock) readIndexRange(ctx context.Context, off, length int64, logger log.Logger) ([]byte, error) {\n\tr, err := b.bkt.GetRange(ctx, b.indexFilename(), off, length)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"get range reader\")\n\t}\n\tdefer runutil.CloseWithLogOnErr(logger, r, \"readIndexRange close range reader\")\n\n\t// Preallocate the buffer with the exact size so we don't waste allocations\n\t// while progressively growing an initial small buffer. The buffer capacity\n\t// is increased by MinRead to avoid extra allocations due to how ReadFrom()","sourceCodeStart":2482,"sourceCodeEnd":2518,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/store/bucket.go#L2482-L2518","documentation":"When lazy-loading a block, bucketBlockSet/bucketBlock lists all chunk objects under <ULID>/chunks/ in the bucket via bkt.Iter. Failure to enumerate the object storage listing is wrapped as \"list chunk files\" and prevents loading the block.","triggerScenarios":"The object store Iter call on the block's chunks directory fails: bucket permission revoked, object storage outage, throttling, or misconfigured bucket credentials.","commonSituations":"Expired cloud credentials or removed IAM list permission; S3/GCS rate limiting under heavy fan-out; temporary object-storage 5xx; bucket deleted or renamed.","solutions":["Verify bucket credentials and that the principal has list permission on the bucket/prefix","Check object-storage availability and rate limits; add backoff/retry","Confirm the bucket and block prefix still exist (block may have been deleted/compacted away)","Inspect the wrapped error for the provider-specific cause (403 vs 5xx vs timeout)"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// pre-flight: ensure list access\nit := bkt.Iter(ctx, blockPrefix, func(string) error { return nil })","typeGuard":null,"tryCatchPattern":"if err = bkt.Iter(ctx, path.Join(meta.ULID.String(), block.ChunksDirname), func(n string) error {\n    b.chunkObjs = append(b.chunkObjs, n)\n    return nil\n}); err != nil {\n    return nil, errors.Wrap(err, \"list chunk files\")\n}","preventionTips":["Grant list permission on the bucket to the store gateway principal","Rotate credentials before expiry; monitor auth failures","Apply backoff/retry on provider rate limits"],"tags":["object-storage","s3","permissions"],"backgroundTag":"http-error-response","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"}