{"record":{"id":"a81a68abec6a8d3e","repo":"kubernetes/kops","slug":"calling-iam-getrole-on-s-w-a81a68","errorCode":null,"errorMessage":"calling IAM GetRole on %s: %w","messagePattern":"calling IAM GetRole on (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/aws/aws.go","lineNumber":2013,"sourceCode":"\t\tfor paginator.HasMorePages() {\n\t\t\tpage, err := paginator.NextPage(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error listing IAM roles: %v\", err)\n\t\t\t}\n\t\t\tfor _, r := range page.Roles {\n\t\t\t\tname := aws.ToString(r.RoleName)\n\n\t\t\t\tgetRequest := &iam.GetRoleInput{RoleName: r.RoleName}\n\t\t\t\troleOutput, err := c.IAM().GetRole(ctx, getRequest)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif awsup.IsIAMNoSuchEntityException(err) {\n\t\t\t\t\t\tklog.Warningf(\"could not find role %q. Resource may already have been deleted: %v\", name, err)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t} else if awsup.AWSErrorCode(err) == \"403\" {\n\t\t\t\t\t\tklog.Warningf(\"failed to determine ownership of %q: %v\", name, err)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\treturn nil, fmt.Errorf(\"calling IAM GetRole on %s: %w\", name, err)\n\t\t\t\t}\n\t\t\t\tfor _, tag := range roleOutput.Role.Tags {\n\t\t\t\t\tif fi.ValueOf(tag.Key) == ownershipTag && fi.ValueOf(tag.Value) == \"owned\" {\n\t\t\t\t\t\tresourceTracker := &resources.Resource{\n\t\t\t\t\t\t\tName:    name,\n\t\t\t\t\t\t\tID:      name,\n\t\t\t\t\t\t\tType:    \"iam-role\",\n\t\t\t\t\t\t\tDeleter: DeleteIAMRole,\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresourceTrackers = append(resourceTrackers, resourceTracker)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resourceTrackers, nil\n}","sourceCodeStart":1995,"sourceCodeEnd":2031,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/aws/aws.go#L1995-L2031","documentation":"Fires in ListIAMRoles when iam.GetRole fails for a specific role with an error that is neither NoSuchEntity (skipped with a warning) nor a 403 (warned and skipped) — an unexpected API failure while fetching role details.","triggerScenarios":"Thrown at pkg/resources/aws/aws.go:2013 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check iam:GetRole permission for the role ARN","Retry; transient throttling or API errors can be resolved by re-running","Inspect the wrapped error code to see why neither the NoSuchEntity nor 403 path applied"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}