{"record":{"id":"43ddc4f50a41b6ba","repo":"kubernetes/kops","slug":"spotinst-unable-to-resolve-image-q-not-found","errorCode":null,"errorMessage":"spotinst: unable to resolve image %q: not found","messagePattern":"spotinst: unable to resolve image %q: not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/spotinsttasks/elastigroup.go","lineNumber":1878,"sourceCode":"\tif e.Orientation == nil || (e.Orientation != nil && fi.ValueOf(e.Orientation) == \"\") {\n\t\te.Orientation = new(\"balanced\")\n\t}\n\n\tif e.Monitoring == nil {\n\t\te.Monitoring = new(false)\n\t}\n\n\tif e.HealthCheckType == nil {\n\t\te.HealthCheckType = new(\"K8S_NODE\")\n\t}\n}\n\nfunc resolveImage(cloud awsup.AWSCloud, name string) (*ec2types.Image, error) {\n\timage, err := cloud.ResolveImage(name)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"spotinst: unable to resolve image %q: %v\", name, err)\n\t} else if image == nil {\n\t\treturn nil, fmt.Errorf(\"spotinst: unable to resolve image %q: not found\", name)\n\t}\n\n\treturn image, nil\n}\n\nfunc subnetSlicesEqualIgnoreOrder(l, r []*awstasks.Subnet) bool {\n\tvar lIDs []string\n\tfor _, s := range l {\n\t\tlIDs = append(lIDs, *s.ID)\n\t}\n\n\tvar rIDs []string\n\tfor _, s := range r {\n\t\tif s.ID == nil {\n\t\t\tklog.V(4).Infof(\"Subnet ID not set; returning not-equal: %v\", s)\n\t\t\treturn false\n\t\t}\n\t\trIDs = append(rIDs, *s.ID)","sourceCodeStart":1860,"sourceCodeEnd":1896,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/spotinsttasks/elastigroup.go#L1860-L1896","documentation":"resolveImage wraps kops' AWSCloud.ResolveImage when provisioning a Spotinst Elastigroup. When the lookup succeeds but returns no image (nil), it reports that the requested AMI identifier/name could not be found. This means the given image name did not resolve to any AMI visible to the configured AWS credentials.","triggerScenarios":"Calling create/update on an Elastigroup task whose Image field is an AMI name/alias that AWS APIs return no match for: cloud.ResolveImage(name) returns (nil, nil).","commonSituations":"Typo in AMI name; AMI does not exist in the target region; AMI is private or was deregistered; using a Debian/Ubuntu name without the image config; wrong AWS account/credentials.","solutions":["Verify the image name/AMI ID exists in the target region (aws ec2 describe-images)","Run kops get cluster --cloud aws and update the cluster spec's kubernetesVersion/image to a valid AMI for that region","If using a custom AMI, confirm the AMI is shared with the account whose credentials kops uses","Check AWS credentials/profile point to the intended account and region"],"exampleFix":"// before (cluster spec)\nimage: ami-0abcdef1234567890\n// after\nimage: ami-0123456789abcdef0  # AMI present in the target region","handlingStrategy":"validation","validationCode":"out, err := cloud.ResolveImage(name)\nif err != nil {\n    return fmt.Errorf(\"resolving image %q: %w\", name, err)\n}\nif out == nil {\n    return fmt.Errorf(\"image %q does not exist in region %s; check the AMI id/name\", name, cloud.Region())\n}","typeGuard":"func imageFound(img *ec2types.Image) bool { return img != nil }","tryCatchPattern":"if err != nil {\n    var notFound bool\n    if strings.Contains(err.Error(), \"not found\") {\n        notFound = true\n    }\n    if notFound {\n        // fall back to a region-appropriate default AMI\n    }\n}","preventionTips":["Pin AMI IDs per region in the cluster spec","Validate image names with aws ec2 describe-images before applying","Keep credentials/profile aligned with the intended account and region","Watch for deregistered/private AMIs after base-image updates"],"tags":["spotinst","aws","ami","image-resolution"],"backgroundTag":"ami-not-found","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"}