{"record":{"id":"99cab91414f404f4","repo":"kubernetes/kops","slug":"instance-not-found-while-waiting-for-instance-to-b","errorCode":null,"errorMessage":"instance not found while waiting for instance to be running","messagePattern":"instance not found while waiting for instance to be running","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awsup/aws_apitarget.go","lineNumber":130,"sourceCode":"\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error removing tags from ELBV2 %q: %v\", ResourceArn, err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (t *AWSAPITarget) WaitForInstanceRunning(instanceID string) error {\n\tattempt := 0\n\tfor {\n\t\tinstance, err := t.Cloud.DescribeInstance(instanceID)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error while waiting for instance to be running: %v\", err)\n\t\t}\n\n\t\tif instance == nil {\n\t\t\t// TODO: Wait if we _just_ created the instance?\n\t\t\treturn fmt.Errorf(\"instance not found while waiting for instance to be running\")\n\t\t}\n\n\t\tstate := \"?\"\n\t\tif instance.State != nil {\n\t\t\tstate = string(instance.State.Name)\n\t\t}\n\t\tif state == \"running\" {\n\t\t\treturn nil\n\t\t}\n\t\tklog.Infof(\"Waiting for instance %q to be running (current state is %q)\", instanceID, state)\n\n\t\ttime.Sleep(10 * time.Second)\n\t\tattempt++\n\t\tif attempt > 30 {\n\t\t\treturn fmt.Errorf(\"timeout waiting for instance %q to be running, state was %q\", instanceID, state)\n\t\t}\n\t}\n}","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awsup/aws_apitarget.go#L112-L148","documentation":"The polling loop in WaitForInstanceRunning got a successful describe response but no instance: the EC2 instance no longer exists — typically terminated between creation and this check (capacity reclaim, manual deletion, or failed launch).","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/awsup/aws_apitarget.go:130 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the AWS console for why the instance vanished (terminated, failed status checks)","Re-run `kops update`/apply so a replacement instance is created","Check instance limits and capacity in the availability zone"],"exampleFix":null,"handlingStrategy":"validation","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"}