{"record":{"id":"a30063a7b1ccc2e8","repo":"kubernetes/kops","slug":"found-instance-q-but-status-is-q","errorCode":null,"errorMessage":"found instance %q, but status is %q","messagePattern":"found instance %q, but status is %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/nodeidentity/gce/identify.go","lineNumber":125,"sourceCode":"\t\treturn nil, fmt.Errorf(\"providerID %q not recognized for node %s\", providerID, node.Name)\n\t}\n\n\tproject := tokens[0]\n\tzone := tokens[1]\n\tinstanceName := tokens[2]\n\n\tif project != i.project {\n\t\treturn nil, fmt.Errorf(\"providerID %q did not match our project %q\", providerID, i.project)\n\t}\n\n\tinstance, err := i.getInstance(zone, instanceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinstanceStatus := instance.Status\n\tif instanceStatus != \"RUNNING\" {\n\t\treturn nil, fmt.Errorf(\"found instance %q, but status is %q\", instanceName, instanceStatus)\n\t}\n\n\tcapgRole := instance.Labels[LabelKeyCAPIRoleName]\n\n\tvar capiMachine *clusterapi.Machine\n\n\tif i.capiManager != nil && capgRole != \"\" {\n\t\tproviderID := \"gce://\" + project + \"/\" + zone + \"/\" + instanceName\n\n\t\tm, err := i.capiManager.FindMachineByProviderID(ctx, providerID)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error finding Machine with providerID %q: %w\", providerID, err)\n\t\t}\n\t\tcapiMachine = m\n\t}\n\n\tvar igName string\n\tif capiMachine == nil {","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/nodeidentity/gce/identify.go#L107-L143","documentation":"After fetching the instance from the GCE API, IdentifyNode only proceeds if the instance status is \"RUNNING\". Instances in PROVISIONING, STAGING, TERMINATED, or STOPPED states cannot be reliably identified (labels/metadata may be incomplete or the node is going away), so the identification is aborted with this message.","triggerScenarios":"Calling IdentifyNode for a node whose GCE instance exists but whose Status field returned by compute.Instances.Get is anything other than \"RUNNING\" — e.g. the instance is being deleted, stopped, or just starting.","commonSituations":"Node deleted concurrently with identification (autoscaler scale-down); instance stopped manually or preempted; a Node object lingering in the k8s API after its VM was terminated; race where kubelet registered before the instance reached RUNNING.","solutions":["Re-run identification once the instance is RUNNING (TRANSIENT — wait/retry, e.g. with backoff).","If the instance is TERMINATED and the node should be gone, delete the stale Node object instead of identifying it.","For preemptible/spot instances, expect frequent restarts and handle this error by requeueing.","Check GCE console / `gcloud compute instances describe <name> --zone <zone> --format='value(status)'` to see actual state and why."],"exampleFix":"// before\ninfo, err := id.IdentifyNode(ctx, node) // instance still PROVISIONING\n// after\nerr := wait.PollImmediate(5*time.Second, 2*time.Minute, func() (bool, error) {\n    _, err := id.IdentifyNode(ctx, node)\n    return err == nil, nil // retry until instance is RUNNING\n})","handlingStrategy":"retry","validationCode":"status, err := computeSvc.Instances.Get(project, zone, instanceName).Do()\nif err == nil && status.Status != \"RUNNING\" {\n    return fmt.Errorf(\"instance %s not ready (status %s); retry later\", instanceName, status.Status)\n}","typeGuard":"func isRunning(inst *compute.Instance) bool {\n    return inst != nil && inst.Status == \"RUNNING\"\n}","tryCatchPattern":"info, err := identifier.IdentifyNode(ctx, node)\nif err != nil && strings.Contains(err.Error(), \"but status is\") {\n    // transient: instance starting/stopping; requeue with backoff\n    return requeueAfter(30 * time.Second)\n}","preventionTips":["Requeue identification with backoff for non-RUNNING instances.","Treat TERMINATED instances as signals to delete the stale Node object.","Expect frequent restarts with preemptible/spot VMs and handle gracefully.","Check instance status via gcloud before debugging deeper."],"tags":["gce","kubernetes","node-identity","instance-state","transient"],"backgroundTag":"instance-not-running","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"}