{"record":{"id":"b312ddd20b76700e","repo":"kubernetes/kops","slug":"error-listing-iam-role-policies-for-q-v","errorCode":null,"errorMessage":"error listing IAM role policies for %q: %v","messagePattern":"error listing IAM role policies for %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/aws/aws.go","lineNumber":1919,"sourceCode":"\tvar policyNames []string\n\n\tc := cloud.(awsup.AWSCloud)\n\troleName := r.Name\n\n\t// List Inline policies\n\t{\n\t\trequest := &iam.ListRolePoliciesInput{\n\t\t\tRoleName: aws.String(roleName),\n\t\t}\n\t\tpaginator := iam.NewListRolePoliciesPaginator(c.IAM(), request)\n\t\tfor paginator.HasMorePages() {\n\t\t\tpage, err := paginator.NextPage(ctx)\n\t\t\tif err != nil {\n\t\t\t\tif awsup.IsIAMNoSuchEntityException(err) {\n\t\t\t\t\tklog.V(2).Infof(\"Got NoSuchEntity describing IAM RolePolicy %q; will treat as already-deleted\", roleName)\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\treturn fmt.Errorf(\"error listing IAM role policies for %q: %v\", roleName, err)\n\t\t\t}\n\t\t\tpolicyNames = append(policyNames, page.PolicyNames...)\n\t\t}\n\t}\n\n\t// List Attached Policies\n\t{\n\t\trequest := &iam.ListAttachedRolePoliciesInput{\n\t\t\tRoleName: aws.String(roleName),\n\t\t}\n\t\tpaginator := iam.NewListAttachedRolePoliciesPaginator(c.IAM(), request)\n\t\tfor paginator.HasMorePages() {\n\t\t\tpage, err := paginator.NextPage(ctx)\n\t\t\tif err != nil {\n\t\t\t\tif awsup.IsIAMNoSuchEntityException(err) {\n\t\t\t\t\tklog.V(2).Infof(\"Got NoSuchEntity describing IAM RolePolicy %q; will treat as already-deleted\", roleName)\n\t\t\t\t\treturn nil\n\t\t\t\t}","sourceCodeStart":1901,"sourceCodeEnd":1937,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/aws/aws.go#L1901-L1937","documentation":"Fires when iam.ListRolePolicies pagination fails for an IAM role during deletion. NoSuchEntity is treated as already-deleted and returns nil; any other error (permissions, throttling) aborts with this message.","triggerScenarios":"Thrown at pkg/resources/aws/aws.go:1919 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check IAM permissions (iam:ListRolePolicies) for the credentials in use","Retry after throttling (inspect wrapped error for Throttling/SlowDown)","If the role was concurrently deleted, re-run discovery so it is treated as deleted"],"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"}