{"record":{"id":"8bf3171f91b60761","repo":"kubernetes/kops","slug":"unable-to-resolve-image-q-not-found-8bf317","errorCode":null,"errorMessage":"unable to resolve image %q: not found","messagePattern":"unable to resolve image %q: not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/template_functions_karpenter.go","lineNumber":395,"sourceCode":"\t\t},\n\t}, nil\n}\n\n// karpenterRootDeviceName resolves the root device name of the InstanceGroup image, so\n// that the generated block device mapping overrides the image's root volume rather than\n// attaching an additional one. The name varies between images (/dev/xvda, /dev/sda1),\n// so it has to come from the image itself.\nfunc (tf *TemplateFunctions) karpenterRootDeviceName(image string) (string, error) {\n\tcloud, ok := tf.cloud.(awsup.AWSCloud)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"expected an AWS cloud, got %T\", tf.cloud)\n\t}\n\tresolved, err := cloud.ResolveImage(image)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"unable to resolve image %q: %w\", image, err)\n\t}\n\tif resolved == nil {\n\t\treturn \"\", fmt.Errorf(\"unable to resolve image %q: not found\", image)\n\t}\n\trootDeviceName := fi.ValueOf(resolved.RootDeviceName)\n\tif rootDeviceName == \"\" {\n\t\treturn \"\", fmt.Errorf(\"image %q has no root device name\", image)\n\t}\n\treturn rootDeviceName, nil\n}\n\nfunc (tf *TemplateFunctions) buildKarpenterNodePool(ig *kops.InstanceGroup) (*karpenterNodePool, error) {\n\tlabels, err := nodelabels.BuildNodeLabels(tf.Cluster, ig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"building node labels for %q: %w\", ig.Name, err)\n\t}\n\tlabels = karpenterNodePoolTemplateLabels(labels)\n\n\ttemplate := karpenterNodeClaimTemplate{\n\t\tSpec: karpenterNodeClaimSpec{\n\t\t\tRequirements: tf.karpenterRequirements(ig),","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/template_functions_karpenter.go#L377-L413","documentation":"kops successfully queried EC2 for the image but ResolveImage returned nil — no matching AMI exists (or is visible to the account) for the given image spec. karpenterRootDeviceName turns that into 'unable to resolve image %q: not found' while building the Karpenter EC2NodeClass.","triggerScenarios":"Passing an image identifier that matches zero AMIs: deleted/deregistered AMI id, wrong owner alias, or a name filter matching nothing in the configured region.","commonSituations":"AMI deregistered since the cluster spec was written; AMI exists in us-east-1 but cluster targets eu-west-1; custom owner alias not recognized; typo in the image name.","solutions":["Confirm the AMI id exists via `aws ec2 describe-images --image-ids <id>` in the cluster's region","Check the region in the cluster spec matches where the AMI lives","Use a kops-supported image alias or a current AMI (e.g. from kops ensure-defaults or official image lists)","If the AMI was deleted, pick a new one and update the instance group spec"],"exampleFix":"// before\nimage: ami-0deleted1234567890\n// after\nimage: ami-0abcdef1234567890  # verified in target region via aws ec2 describe-images","handlingStrategy":"validation","validationCode":"// verify AMI exists before update\nout, err := ec2Client.DescribeImages(&ec2.DescribeImagesInput{ImageIds: []string{image}})\nif err != nil || len(out.Images) == 0 {\n\treturn fmt.Errorf(\"AMI %s not found in region %s\", image, region)\n}","typeGuard":null,"tryCatchPattern":"if _, err := tf.karpenterRootDeviceName(image); err != nil && strings.Contains(err.Error(), \"not found\") {\n\treturn fmt.Errorf(\"AMI missing; pick a current image for region %s\", region)\n}","preventionTips":["Confirm AMI ids with `aws ec2 describe-images --image-ids` in the cluster region","Watch for kops image deprecations and update the cluster spec accordingly","Avoid hard-coding AMIs from a different region"],"tags":["aws","ec2","ami","not-found","karpenter"],"backgroundTag":"image-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"}