{"record":{"id":"3dbf60a0ce52ab74","repo":"thanos-io/thanos","slug":"get-object-attributes-of-s","errorCode":null,"errorMessage":"get object attributes of %s","messagePattern":"get object attributes of (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/block/indexheader/binary_reader.go","lineNumber":185,"sourceCode":"\t\treturn nil, os.Rename(tmpFilename, filename)\n\t}\n\n\treturn bw.Buffer(), nil\n}\n\ntype chunkedIndexReader struct {\n\tctx  context.Context\n\tpath string\n\tsize uint64\n\tbkt  objstore.BucketReader\n\ttoc  *index.TOC\n}\n\nfunc newChunkedIndexReader(ctx context.Context, bkt objstore.BucketReader, id ulid.ULID) (*chunkedIndexReader, int, error) {\n\tindexFilepath := filepath.Join(id.String(), block.IndexFilename)\n\tattrs, err := bkt.Attributes(ctx, indexFilepath)\n\tif err != nil {\n\t\treturn nil, 0, errors.Wrapf(err, \"get object attributes of %s\", indexFilepath)\n\t}\n\n\trc, err := bkt.GetRange(ctx, indexFilepath, 0, index.HeaderLen)\n\tif err != nil {\n\t\treturn nil, 0, errors.Wrapf(err, \"get TOC from object storage of %s\", indexFilepath)\n\t}\n\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 {","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/block/indexheader/binary_reader.go#L167-L203","documentation":"newChunkedIndexReader starts WriteBinary by fetching object-storage attributes (size) of the block's index file at <block-id>/index. This error wraps a failure of bkt.Attributes(ctx, indexFilepath): the object could not be stat'ed in the bucket (does not exist, no permission, or the object-store request failed).","triggerScenarios":"WriteBinary -> newChunkedIndexReader -> bkt.Attributes(ctx, \"<ulid>/index\") failing: the block's index object is missing from the bucket (block deleted/partially uploaded), the bucket credentials lack s3:GetObject/HeadObject, the bucket name is wrong, or the object store is unreachable (DNS, 403, 5xx).","commonSituations":"Store Gateway pointed at a bucket where the block was garbage-collected; misconfigured bucket/prefix in the Thanos objstore config; IAM policies stripped HeadObject permission; network outage or wrong endpoint in the objstore provider config.","solutions":["Verify the object <block-id>/index exists in the bucket (aws s3 ls / gsutil ls on the exact path).","Check the Thanos objstore config (bucket name, endpoint, prefix) for typos.","Verify the credentials/IAM role allow Head/Get on the bucket objects.","If the block was deleted by compaction/retention, remove it from the store-gateway's bucket index / meta.json state and re-sync.","Check network connectivity and object-store service status; retry on transient 5xx."],"exampleFix":"// before: assume attributes always available\nattrs, err := bkt.Attributes(ctx, indexFilepath)\n// after: caller-side preflight\nvar exists bool\nerr := bkt.Iter(ctx, id.String()+\"/\", func(string) error { exists = true; return nil })\nif err != nil || !exists {\n    return nil, errors.New(\"block missing from bucket; re-sync or restore\")\n}","handlingStrategy":"validation","validationCode":"// Go: verify block object presence before WriteBinary\nfunc blockIndexExists(ctx context.Context, bkt objstore.BucketReader, id ulid.ULID) error {\n    exists, err := bkt.Exists(ctx, path.Join(id.String(), block.IndexFilename))\n    if err != nil { return err }\n    if !exists { return errors.Errorf(\"block %s index object missing from bucket\", id) }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"// Go\n_, err := indexheader.WriteBinary(ctx, bkt, id, dst)\nif err != nil && strings.Contains(err.Error(), \"get object attributes of\") {\n    var nf objstoreNotFoundError // or check errors.Is on provider SDK error\n    if errors.As(err, &nf) {\n        log.Warn(\"block index vanished from bucket; dropping local reference\", \"block\", id)\n        return ErrBlockMissing // handle upstream instead of crash-looping\n    }\n    return err\n}","preventionTips":["Validate the objstore config with `thanos tools bucket verify` before rollout.","Grant IAM HeadObject/GetObject (s3:GetObject, storage.objects.get) to the service account.","Enable the Thanos bucket index / metadata cache to detect deleted blocks consistently.","Alert on store-gateway crash-loops with attribute errors — usually missing or GC'ed blocks."],"tags":["object-storage","s3","thanos","block"],"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"}