{"record":{"id":"5a8ad52f59930b28","repo":"kubernetes/kops","slug":"error-listing-dhcpoptions-v","errorCode":null,"errorMessage":"error listing DhcpOptions: %v","messagePattern":"error listing DhcpOptions: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/aws/aws.go","lineNumber":991,"sourceCode":"\t\tresourceTracker.Blocks = blocks\n\n\t\tresourceTrackers = append(resourceTrackers, resourceTracker)\n\t}\n\n\treturn resourceTrackers, nil\n}\n\nfunc DescribeDhcpOptions(cloud fi.Cloud) ([]ec2types.DhcpOptions, error) {\n\tctx := context.TODO()\n\tc := cloud.(awsup.AWSCloud)\n\n\tklog.V(2).Infof(\"Listing EC2 DhcpOptions\")\n\trequest := &ec2.DescribeDhcpOptionsInput{\n\t\tFilters: BuildEC2Filters(cloud),\n\t}\n\tresponse, err := c.EC2().DescribeDhcpOptions(ctx, request)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing DhcpOptions: %v\", err)\n\t}\n\n\treturn response.DhcpOptions, nil\n}\n\nfunc DeleteInternetGateway(cloud fi.Cloud, r *resources.Resource) error {\n\tctx := context.TODO()\n\tc := cloud.(awsup.AWSCloud)\n\n\tid := r.ID\n\n\tvar igw *ec2types.InternetGateway\n\t{\n\t\trequest := &ec2.DescribeInternetGatewaysInput{\n\t\t\tInternetGatewayIds: []string{id},\n\t\t}\n\t\tresponse, err := c.EC2().DescribeInternetGateways(ctx, request)\n\t\tif err != nil {","sourceCodeStart":973,"sourceCodeEnd":1009,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/aws/aws.go#L973-L1009","documentation":"kOps wraps failures from the EC2 DescribeDhcpOptions API, which lists DHCP options sets carrying the cluster tags. Any API error is wrapped and aborts discovery of leftover DHCP options during cluster deletion.","triggerScenarios":"EC2 DescribeDhcpOptions returns an error: invalid credentials, throttling, network outage, or an invalid filter combination produced by BuildEC2Filters.","commonSituations":"Expired session during long deletion runs; EC2 rate limiting under concurrent operations; region misconfiguration causing the call to hit the wrong endpoint.","solutions":["Verify credentials/region with `aws ec2 describe-dhcp-options --region <region>`","If throttled, wait and rerun; the describe call is read-only and safe to retry","Refresh AWS credentials (SSO/token expiry) before long-running deletes","Check network access to the EC2 endpoint"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// preflight: credentials + region sanity\n_, err := sts.New(sess).GetCallerIdentity(&sts.GetCallerIdentityInput{})\nif err != nil { return fmt.Errorf(\"credentials: %w\", err) }\n_, err = ec2cli.DescribeDhcpOptions(&ec2.DescribeDhcpOptionsInput{MaxResults: aws.Int64(5)})\nif err != nil { return fmt.Errorf(\"EC2 API unreachable: %w\", err) }","typeGuard":null,"tryCatchPattern":"var opts []ec2types.DhcpOptions\nerr := backoff.Retry(func() error {\n\tvar e error\n\topts, e = aws.DescribeDhcpOptions(cloud)\n\tif e != nil && strings.Contains(e.Error(), \"Throttling\") {\n\t\treturn e // retryable\n\t}\n\treturn backoff.Permanent(e)\n}, backoff.WithMaxRetries(backoff.NewExponentialBackOff(), 5))","preventionTips":["Refresh SSO/STS tokens before starting multi-hour cluster teardowns","Limit parallel kOps operations to avoid EC2 throttling","Validate the region in the kops cluster config before deleting","Retry the read-only describe freely; it is safe"],"tags":["aws","ec2","dhcp-options","api-error"],"backgroundTag":"aws-api-request-failed","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"}