{"record":{"id":"b13a80dbc61e1297","repo":"kubernetes/kops","slug":"calling-iam-getrole-on-s-w","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/model/awsmodel/iam.go","lineNumber":484,"sourceCode":"func (b *IAMModelBuilder) FindDeletions(context *fi.CloudupModelBuilderContext, cloud fi.Cloud) error {\n\tctx := context.Context()\n\tiamapi := cloud.(awsup.AWSCloud).IAM()\n\townershipTag := \"kubernetes.io/cluster/\" + b.Cluster.ObjectMeta.Name\n\trequest := &awsiam.ListRolesInput{}\n\tpaginator := awsiam.NewListRolesPaginator(iamapi, request)\n\tfor paginator.HasMorePages() {\n\t\tpage, err := paginator.NextPage(ctx)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"listing IAM roles: %w\", err)\n\t\t}\n\t\tfor _, role := range page.Roles {\n\t\t\tif !strings.HasSuffix(fi.ValueOf(role.RoleName), \".\"+b.Cluster.ObjectMeta.Name) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tgetRequest := &awsiam.GetRoleInput{RoleName: role.RoleName}\n\t\t\troleOutput, err := iamapi.GetRole(ctx, getRequest)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"calling IAM GetRole on %s: %w\", fi.ValueOf(role.RoleName), err)\n\t\t\t}\n\t\t\tfor _, tag := range roleOutput.Role.Tags {\n\t\t\t\tif fi.ValueOf(tag.Key) == ownershipTag && fi.ValueOf(tag.Value) == \"owned\" {\n\t\t\t\t\tif _, ok := context.Tasks[\"IAMRole/\"+fi.ValueOf(role.RoleName)]; !ok {\n\t\t\t\t\t\tcontext.AddTask(&awstasks.IAMRole{\n\t\t\t\t\t\t\tID:        role.RoleId,\n\t\t\t\t\t\t\tName:      role.RoleName,\n\t\t\t\t\t\t\tLifecycle: b.Lifecycle,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":466,"sourceCodeEnd":501,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/awsmodel/iam.go#L466-L501","documentation":"IAM GetRole on a specific role name failed during deletion discovery; the role may be unreadable due to permissions or was concurrently deleted, and unlike the listing call this lookup is not paginated or retried.","triggerScenarios":"Thrown at pkg/model/awsmodel/iam.go:484 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check iam:GetRole permissions for the identity in use","Verify the role still exists in the AWS console","Re-run the operation once IAM state is consistent"],"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"}