{"record":{"id":"75d30c92eb433136","repo":"kubernetes/kops","slug":"error-listing-images-v","errorCode":null,"errorMessage":"error listing images: %v","messagePattern":"error listing images: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awsup/aws_cloud.go","lineNumber":1749,"sourceCode":"\t\t\t// self is a well-known value in the DescribeImages call\n\t\t\trequest.Owners = []string{\"self\"}\n\t\t\trequest.Filters = append(request.Filters, NewEC2Filter(\"name\", name))\n\t\t} else if len(tokens) == 2 {\n\t\t\towner := ResolveImageOwnerAlias(tokens[0])\n\n\t\t\trequest.Owners = []string{owner}\n\t\t\trequest.Filters = append(request.Filters, NewEC2Filter(\"name\", tokens[1]))\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"image name specification not recognized: %q\", name)\n\t\t}\n\t}\n\n\tvar image *ec2types.Image\n\tpaginator := ec2.NewDescribeImagesPaginator(ec2Client, request)\n\tfor paginator.HasMorePages() {\n\t\tpage, err := paginator.NextPage(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error listing images: %v\", err)\n\t\t}\n\n\t\tfor _, v := range page.Images {\n\t\t\tif image == nil {\n\t\t\t\timage = &v\n\t\t\t} else {\n\t\t\t\titime, _ := time.Parse(time.RFC3339, *image.CreationDate)\n\t\t\t\tvtime, _ := time.Parse(time.RFC3339, *v.CreationDate)\n\t\t\t\tif vtime.After(itime) {\n\t\t\t\t\timage = &v\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif image == nil {\n\t\treturn nil, fmt.Errorf(\"could not find Image for %q\", name)\n\t}\n","sourceCodeStart":1731,"sourceCodeEnd":1767,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awsup/aws_cloud.go#L1731-L1767","documentation":"The paginated EC2 DescribeImages call failed while resolving an image name (e.g. owner/name) to a concrete AMI. Fires on API errors, throttling, or an invalid owner/image-name specification that the API rejects.","triggerScenarios":"paginator.NextPage(ctx) returns an error from DescribeImages: invalid filter values (bad owner ID or name pattern), expired/missing credentials, throttling (RequestLimitExceeded), or unauthorized DescribeImages.","commonSituations":"IAM role lacks ec2:DescribeImages; owner specified as a malformed account ID; API rate limits hit during large batch operations; VPC endpoint or proxy blocking EC2 API traffic.","solutions":["Check the wrapped AWS message: AccessDenied → add ec2:DescribeImages; Throttling → back off and retry","Validate the owner and name filter by running `aws ec2 describe-images --owners <owner> --filters Name=name,Values=<name>`","Fix credentials/region so the EC2 client targets the intended account and region","Retry later if it is a rate-limit error; batch kops operations to reduce call volume"],"exampleFix":"// before\n# AccessDenied on describe-images\n// after\n# attach to the IAM policy:\n{\"Effect\":\"Allow\",\"Action\":[\"ec2:DescribeImages\"],\"Resource\":\"*\"}","handlingStrategy":"retry","validationCode":"// Pre-check IAM: the caller must be able to describe images\n_, err := ec2Client.DescribeImages(ctx, &ec2.DescribeImagesInput{\n\tOwners: []string{owner},\n\tFilters: []ec2types.Filter{ec2filter(\"name\", imageName)},\n\tMaxResults: aws.Int32(5),\n})\nif err != nil { return fmt.Errorf(\"preflight describe-images failed: %w\", err) }","typeGuard":null,"tryCatchPattern":"img, err := resolveImage(ctx, ssmClient, ec2Client, name)\nif err != nil {\n\tif strings.Contains(err.Error(), \"Throttling\") {\n\t\ttime.Sleep(backoff); return resolveImage(ctx, ssmClient, ec2Client, name)\n\t}\n\treturn err\n}","preventionTips":["Ensure ec2:DescribeImages is in the caller's IAM policy","Throttle concurrent kops operations to avoid RequestLimitExceeded","Test the exact owner/name filter with the AWS CLI before automating it"],"tags":["aws","ec2","ami","iam","api-error"],"backgroundTag":"aws-api-call-failed","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"}