{"record":{"id":"09a395b3f96c6788","repo":"kubernetes/kops","slug":"error-listing-instances-v","errorCode":null,"errorMessage":"error listing instances: %v","messagePattern":"error listing instances: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/instance.go","lineNumber":88,"sourceCode":"\tvar request *ec2.DescribeInstancesInput\n\n\tif fi.ValueOf(e.Shared) {\n\t\tvar instanceIds []string\n\t\tinstanceIds = append(instanceIds, aws.ToString(e.ID))\n\t\trequest = &ec2.DescribeInstancesInput{\n\t\t\tInstanceIds: instanceIds,\n\t\t}\n\t} else {\n\t\tfilters := cloud.BuildFilters(e.Name)\n\t\tfilters = append(filters, awsup.NewEC2Filter(\"instance-state-name\", \"pending\", \"running\", \"stopping\", \"stopped\"))\n\t\trequest = &ec2.DescribeInstancesInput{\n\t\t\tFilters: filters,\n\t\t}\n\t}\n\n\tresponse, err := cloud.EC2().DescribeInstances(ctx, request)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing instances: %v\", err)\n\t}\n\n\tinstances := []ec2types.Instance{}\n\tif response != nil {\n\t\tfor _, reservation := range response.Reservations {\n\t\t\tinstances = append(instances, reservation.Instances...)\n\t\t}\n\t}\n\n\tif len(instances) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tif len(instances) != 1 {\n\t\treturn nil, fmt.Errorf(\"found multiple Instances with name: %s\", *e.Name)\n\t}\n\n\tklog.V(2).Info(\"found existing instance\")","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/instance.go#L70-L106","documentation":"The Instance task's Find() discovers the existing EC2 instance matching the task by filters (name tag, etc.) using DescribeInstances; an SDK error there is wrapped as this message. Find is invoked by the fitask framework during apply and by reconciliation, so an AWS API failure here blocks the task's reconciliation.","triggerScenarios":"cloud.EC2().DescribeInstances(ctx, request) returns any error: throttling (RequestLimitExceeded), invalid/unsupported filter, auth failure, or region/endpoint problems.","commonSituations":"Large clusters hitting EC2 describe rate limits; stale credentials or expired STS tokens; VPC/region misconfiguration in kops cluster spec; AWS outage.","solutions":["Inspect the wrapped AWS error code; for RequestLimitExceeded, retry after backoff.","Validate AWS credentials (aws sts get-caller-identity) and that the cluster region is correct.","Re-run kops update/apply once the AWS API is reachable.","Reduce concurrent API usage if self-throttling in CI pipelines."],"exampleFix":"// no code fix; typical remediation\n// before: expired creds -> UnauthorizedOperation\n// after: aws login / refresh credentials, then re-run kops update","handlingStrategy":"retry","validationCode":"// before apply, confirm API reachability & identity\n_, err := sts.GetCallerIdentity(ctx, &sts.GetCallerIdentityInput{})\nif err != nil { return fmt.Errorf(\"AWS API unreachable: %w\", err) }","typeGuard":"var ae smithy.APIError\nif errors.As(err, &ae) {\n  retryable := ae.ErrorCode() == \"RequestLimitExceeded\" || ae.ErrorCode() == \"ThrottlingException\"\n}","tryCatchPattern":"var ae smithy.APIError\nif errors.As(err, &ae) && (ae.ErrorCode() == \"RequestLimitExceeded\" || ae.ErrorCode() == \"ThrottlingException\") {\n  return retryWithBackoff(op, 5, time.Second)\n}\nreturn err","preventionTips":["Use the stock kops IAM policy so ec2:Describe* is permitted.","Refresh credentials before long-running CI applies.","Serialize heavy EC2 API usage across concurrent pipelines to avoid throttling.","Check the AWS health dashboard during regional incidents."],"tags":["aws","ec2","api-error","describe-instances"],"backgroundTag":"aws-api-call-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}