{"record":{"id":"11ce609aa91f4c10","repo":"kubernetes/kops","slug":"error-while-waiting-for-instance-to-be-running-v","errorCode":null,"errorMessage":"error while waiting for instance to be running: %v","messagePattern":"error 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":125,"sourceCode":"\t}\n\n\tif len(extra) != 0 {\n\t\tklog.V(4).Infof(\"removing tags from %q: %v\", ResourceArn, extra)\n\t\terr := t.Cloud.RemoveELBV2Tags(ResourceArn, extra)\n\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++","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awsup/aws_apitarget.go#L107-L143","documentation":"WaitForInstanceRunning polls DescribeInstance while waiting for a master to boot; the describe call itself failed (permissions, invalid instance id, throttling) and the AWS error is wrapped.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/awsup/aws_apitarget.go:125 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check ec2:DescribeInstances permissions for the credentials in use","Verify the instance id still exists in the region","Retry the operation for transient errors"],"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"}