{"record":{"id":"09d9c0133535a39e","repo":"kubernetes/kops","slug":"unable-to-resolve-image-q-not-found","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/awstasks/launchtemplate.go","lineNumber":118,"sourceCode":"\n// CompareWithID implements the comparable interface\nfunc (t *LaunchTemplate) CompareWithID() *string {\n\treturn t.ID\n}\n\n// buildRootDevice is responsible for retrieving a boot device mapping from the image name\nfunc (t *LaunchTemplate) buildRootDevice(cloud awsup.AWSCloud) (map[string]*BlockDeviceMapping, error) {\n\timage := fi.ValueOf(t.ImageID)\n\tif image == \"\" {\n\t\treturn map[string]*BlockDeviceMapping{}, nil\n\t}\n\n\t// @step: resolve the image ami\n\timg, err := cloud.ResolveImage(image)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to resolve image: %q: %v\", image, err)\n\t} else if img == nil {\n\t\treturn nil, fmt.Errorf(\"unable to resolve image: %q: not found\", image)\n\t}\n\n\tb := &BlockDeviceMapping{\n\t\tEbsDeleteOnTermination: aws.Bool(true),\n\t\tEbsVolumeSize:          t.RootVolumeSize,\n\t\tEbsVolumeType:          t.RootVolumeType,\n\t\tEbsVolumeIops:          t.RootVolumeIops,\n\t\tEbsVolumeThroughput:    t.RootVolumeThroughput,\n\t\tEbsEncrypted:           t.RootVolumeEncryption,\n\t}\n\tif aws.ToBool(t.RootVolumeEncryption) && aws.ToString(t.RootVolumeKmsKey) != \"\" {\n\t\tb.EbsKmsKey = t.RootVolumeKmsKey\n\t}\n\n\tbm := map[string]*BlockDeviceMapping{\n\t\taws.ToString(img.RootDeviceName): b,\n\t}\n","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/launchtemplate.go#L100-L136","documentation":"The sibling of the resolve-failure case: cloud.ResolveImage succeeded (nil error) but returned nil, meaning no AMI matched the requested image spec. buildRootDevice reports 'unable to resolve image: %q: not found'. kOps cannot construct the root device mapping without a concrete AMI.","triggerScenarios":"RenderAWS/RenderTerraform -> buildRootDevice where ResolveImage finds zero matching images - e.g. an AMI id that doesn't exist in the region, an image alias with no matching DescribeImages result, or a deleted/deregistered AMI.","commonSituations":"AMI deregistered by upstream (base image removed); wrong region (AMI is region-local); typo'd ami- id; using an image alias for a release that is no longer published; encrypted/shared AMI not visible to the account.","solutions":["Set a valid AMI ID for the target region (kops toolbox cluster-config, or spec field image) or use a supported kops image alias.","Verify the AMI exists: aws ec2 describe-images --image-ids ami-... --region <region>.","Upgrade kops - newer versions update image aliases to currently published AMIs.","Check the AMI is shared with/owned by your account and not deregistered."],"exampleFix":"// before\nimage: ami-0123456789deadbeef  // deregistered\n// after\nimage: ami-0abcdef1234567890  // current in us-east-1","handlingStrategy":"validation","validationCode":"// before apply: confirm the AMI exists in-region and is visible\naws ec2 describe-images --region $REGION --image-ids $IMAGE --query 'Images[*].ImageId'\n// empty output => not found; pick a different image","typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \": not found\") { update the image field to a current AMI/alias and re-apply }","preventionTips":["Use supported kops image aliases and keep kops upgraded so aliases track live AMIs.","Check AMI existence in the exact region; AMIs are region-local.","Watch upstream announcements for deregistered base AMIs."],"tags":["aws","ami","image-not-found","launch-template"],"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-12T12:17:11.808Z"}