{"record":{"id":"c992495808091353","repo":"kubernetes/kops","slug":"found-instance-q-but-state-is-q","errorCode":null,"errorMessage":"found instance %q, but state is %q","messagePattern":"found instance %q, but state is %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/nodeidentity/aws/identify.go","lineNumber":131,"sourceCode":"\t\t\tklog.Warningf(\"Nodeidentity info cache lookup failure: %v\", err)\n\t\t}\n\t\tif exists {\n\t\t\treturn obj.(*nodeidentity.Info), nil\n\t\t}\n\t}\n\n\t// Based on node-authorizer code\n\tinstance, err := i.getInstance(ctx, instanceID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar instanceState ec2types.InstanceStateName\n\tif instance.State != nil {\n\t\tinstanceState = instance.State.Name\n\t}\n\tif instanceState != ec2types.InstanceStateNameRunning && instanceState != ec2types.InstanceStateNamePending {\n\t\treturn nil, fmt.Errorf(\"found instance %q, but state is %q\", instanceID, instanceState)\n\t}\n\n\tlabels := map[string]string{}\n\tif len(instance.InstanceLifecycle) > 0 {\n\t\tlabels[fmt.Sprintf(\"node-role.kubernetes.io/%s-worker\", instance.InstanceLifecycle)] = \"true\"\n\t}\n\n\tinfo := &nodeidentity.Info{\n\t\tInstanceID: instanceID,\n\t\tLabels:     labels,\n\t}\n\n\tfor _, tag := range instance.Tags {\n\t\tkey := aws.ToString(tag.Key)\n\t\tif strings.HasPrefix(key, ClusterAutoscalerNodeTemplateLabel) {\n\t\t\tinfo.Labels[strings.TrimPrefix(aws.ToString(tag.Key), ClusterAutoscalerNodeTemplateLabel)] = aws.ToString(tag.Value)\n\t\t}\n\t}","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/nodeidentity/aws/identify.go#L113-L149","documentation":"The EC2 instance backing the node was found via DescribeInstances, but its state is neither running nor pending (e.g. stopped, terminated, shutting-down). Node identity is refused because the instance is not considered operational.","triggerScenarios":"Thrown at pkg/nodeidentity/aws/identify.go:131 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Start the stopped EC2 instance or replace the node","If the instance was replaced, remove the stale Node object so it can be re-registered","Check the AWS console for why the instance left the running state"],"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"}