{"record":{"id":"c9fcbee8b292a786","repo":"kubernetes/kops","slug":"error-searching-for-detached-instances-v","errorCode":null,"errorMessage":"error searching for detached instances: %v","messagePattern":"error searching for detached instances: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awsup/aws_cloud.go","lineNumber":1038,"sourceCode":"\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, i := range result.Instances {\n\t\terr := buildCloudInstance(i, instances, instanceSeen, nodeMap, cg, newConfigName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tvar detached []*string\n\tfor id, instance := range instances {\n\t\tfor _, tag := range instance.Tags {\n\t\t\tif aws.ToString(tag.Key) == tagNameDetachedInstance {\n\t\t\t\tdetached = append(detached, aws.String(id))\n\t\t\t}\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error searching for detached instances: %v\", err)\n\t}\n\tfor _, id := range detached {\n\t\tif id != nil && *id != \"\" && !instanceSeen[*id] {\n\t\t\tcm, err := cg.NewCloudInstance(*id, cloudinstances.CloudInstanceStatusDetached, nodeMap[*id])\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error creating cloud instance group member: %v\", err)\n\t\t\t}\n\t\t\tinstanceSeen[*id] = true\n\t\t\taddCloudInstanceData(cm, instances[aws.ToString(id)])\n\t\t}\n\t}\n\n\treturn cg, nil\n}\n\nfunc buildCloudInstance(i autoscalingtypes.Instance, instances map[string]*ec2types.Instance, instanceSeen map[string]bool, nodeMap map[string]*v1.Node, cg *cloudinstances.CloudInstanceGroup, newConfigName string) error {\n\tid := aws.ToString(i.InstanceId)\n\tif id == \"\" {","sourceCodeStart":1020,"sourceCodeEnd":1056,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awsup/aws_cloud.go#L1020-L1056","documentation":"Residual error guard after scanning the instance map for the kOps detached-instance tag: an earlier DescribeInstances-style error (stored in err) surfaces here, aborting the detached-instance handling in awsBuildCloudInstanceGroup.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/awsup/aws_cloud.go:1038 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped %v error to find the failing AWS call","Verify ec2:DescribeInstances permissions for the credentials","Retry the read-only operation once transient AWS errors clear"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}