{"record":{"id":"370a7c176185aad7","repo":"kubernetes/kops","slug":"instance-type-q-not-found-in-region-q","errorCode":null,"errorMessage":"instance type %q not found in region %q","messagePattern":"instance type %q not found in region %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awsup/aws_cloud.go","lineNumber":2100,"sourceCode":"\tinfo, err := describeInstanceType(c, instanceType)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc.instanceTypes.typeMap[instanceType] = info\n\treturn info, nil\n}\n\nfunc describeInstanceType(c AWSCloud, instanceType string) (*ec2types.InstanceTypeInfo, error) {\n\tctx := context.TODO()\n\treq := &ec2.DescribeInstanceTypesInput{\n\t\tInstanceTypes: []ec2types.InstanceType{ec2types.InstanceType(instanceType)},\n\t}\n\tresp, err := c.EC2().DescribeInstanceTypes(ctx, req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"describing instance type %q in region %q: %w\", instanceType, c.Region(), err)\n\t}\n\tif len(resp.InstanceTypes) != 1 {\n\t\treturn nil, fmt.Errorf(\"instance type %q not found in region %q\", instanceType, c.Region())\n\t}\n\treturn &resp.InstanceTypes[0], nil\n}\n\n// AccountInfo returns the AWS account ID and AWS partition that we are deploying into\nfunc (c *awsCloudImplementation) AccountInfo(ctx context.Context) (string, string, error) {\n\trequest := &sts.GetCallerIdentityInput{}\n\n\tresponse, err := c.sts.GetCallerIdentity(ctx, request)\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"error getting AWS account ID: %v\", err)\n\t}\n\n\tarn, err := arn.Parse(aws.ToString(response.Arn))\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"failed to parse GetCallerIdentity ARN: %w\", err)\n\t}\n","sourceCodeStart":2082,"sourceCodeEnd":2118,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awsup/aws_cloud.go#L2082-L2118","documentation":"Returned when EC2 DescribeInstanceTypes succeeds but returns zero results for the requested instance type (aws_cloud.go:2100). AWS silently omits unknown or region-unsupported instance type names instead of erroring, so kOps explicitly fails with this message. It means the name was accepted as a request but does not exist in that region.","triggerScenarios":"DescribeInstanceTypes returns resp.InstanceTypes with len != 1 — almost always len 0 — because the instance type string is misspelled, malformed (wrong case, e.g. 'T3.Medium'), or not offered in c.Region().","commonSituations":"Using an instance type unavailable in the selected region (e.g. m7g in a region without Graviton support); typo in the kops cluster spec; using a type name with wrong capitalization; referencing a type from a newer AWS generation than the SDK/region supports.","solutions":["Check the instance type exists in the target region: 'aws ec2 describe-instance-types --region <region> --instance-types <type>'.","Fix the spelling/case of the instance type in the cluster spec (lowercase, correct family, e.g. t3.medium).","Pick a substitute type offered in the region, or change the cluster region to one that offers the type.","If using a very new instance type, upgrade kOps to a version whose AWS SDK knows the name."],"exampleFix":"// before (cluster spec, region us-east-2)\ninstanceType: c7a.metal-48xl\n// after\ninstanceType: c7a.4xlarge","handlingStrategy":"validation","validationCode":"// check the type exists in the region BEFORE provisioning\nfunc instanceTypeExists(ctx context.Context, client *ec2.Client, region, name string) (bool, error) {\n\tout, err := client.DescribeInstanceTypes(ctx, &ec2.DescribeInstanceTypesInput{\n\t\tInstanceTypes: []ec2types.InstanceType{ec2types.InstanceType(name)},\n\t})\n\tif err != nil { return false, err }\n\treturn len(out.InstanceTypes) == 1, nil\n}","typeGuard":"func isNotFoundInstanceType(err error) bool {\n\treturn err != nil && strings.Contains(err.Error(), \"not found in region\")\n}","tryCatchPattern":"if err := ensureInstanceType(name, region); err != nil {\n\tif isNotFoundInstanceType(err) {\n\t\treturn fmt.Errorf(\"%s is not offered in %s; pick one from 'aws ec2 describe-instance-types --region %s'\", name, region, region)\n\t}\n\treturn err\n}","preventionTips":["Validate instance type availability per region in CI before applying cluster specs.","Never hand-type instance names; copy from 'aws ec2 describe-instance-types' output.","Remember new instance families (Graviton, metal) are region-gated — check regional availability pages.","Use consistent lowercase naming for all instance type fields."],"tags":["aws","ec2","instance-type","validation"],"backgroundTag":"instance-type-not-found-in-region","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"}