{"record":{"id":"4ca2c0abbe99b52a","repo":"googleapis/mcp-toolbox","slug":"failed-to-get-iam-policy-for-bucket-q-w","errorCode":null,"errorMessage":"failed to get IAM policy for bucket %q: %w","messagePattern":"failed to get IAM policy for bucket %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/cloudstorage/cloudstorage.go","lineNumber":362,"sourceCode":"\tif err := s.validateBucket(bucket); err != nil {\n\t\treturn nil, err\n\t}\n\tattrs, err := s.client.Bucket(bucket).Attrs(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get metadata for bucket %q: %w\", bucket, err)\n\t}\n\treturn attrs, nil\n}\n\n// GetBucketIAMPolicy returns bucket IAM bindings in a stable, agent-friendly\n// shape while preserving conditional bindings when present.\nfunc (s *Source) GetBucketIAMPolicy(ctx context.Context, bucket string) (map[string]any, error) {\n\tif err := s.validateBucket(bucket); err != nil {\n\t\treturn nil, err\n\t}\n\tpolicy, err := s.client.Bucket(bucket).IAM().Policy(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get IAM policy for bucket %q: %w\", bucket, err)\n\t}\n\n\tbindings := make([]map[string]any, 0)\n\tif policy != nil && policy.InternalProto != nil {\n\t\tfor _, binding := range policy.InternalProto.Bindings {\n\t\t\tmembers := append([]string(nil), binding.Members...)\n\t\t\tsort.Strings(members)\n\n\t\t\tout := map[string]any{\n\t\t\t\t\"role\":    binding.Role,\n\t\t\t\t\"members\": members,\n\t\t\t}\n\t\t\tif binding.Condition != nil {\n\t\t\t\tout[\"condition\"] = map[string]any{\n\t\t\t\t\t\"title\":       binding.Condition.Title,\n\t\t\t\t\t\"description\": binding.Condition.Description,\n\t\t\t\t\t\"expression\":  binding.Condition.Expression,\n\t\t\t\t}","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/cloudstorage/cloudstorage.go#L344-L380","documentation":"Error \"failed to get IAM policy for bucket %q: %w\" thrown in googleapis/mcp-toolbox.","triggerScenarios":"Thrown at internal/sources/cloudstorage/cloudstorage.go:362 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}