{"record":{"id":"1e3fbc064252662e","repo":"kubernetes/kops","slug":"error-listing-dhcpoptions-v-1e3fbc","errorCode":null,"errorMessage":"error listing DHCPOptions: %v","messagePattern":"error listing DHCPOptions: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/dhcp_options.go","lineNumber":68,"sourceCode":"var _ fi.CompareWithID = (*DHCPOptions)(nil)\n\nfunc (e *DHCPOptions) CompareWithID() *string {\n\treturn e.ID\n}\n\nfunc (e *DHCPOptions) Find(c *fi.CloudupContext) (*DHCPOptions, error) {\n\tcloud := awsup.GetCloud(c)\n\n\trequest := &ec2.DescribeDhcpOptionsInput{}\n\tif e.ID != nil {\n\t\trequest.DhcpOptionsIds = []string{aws.ToString(e.ID)}\n\t} else {\n\t\trequest.Filters = cloud.BuildFilters(e.Name)\n\t}\n\n\tresponse, err := cloud.EC2().DescribeDhcpOptions(c.Context(), request)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing DHCPOptions: %v\", err)\n\t}\n\n\tif response == nil || len(response.DhcpOptions) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tif len(response.DhcpOptions) != 1 {\n\t\treturn nil, fmt.Errorf(\"found multiple DhcpOptions with name: %s\", *e.Name)\n\t}\n\tklog.V(2).Info(\"found existing DhcpOptions\")\n\to := response.DhcpOptions[0]\n\tactual := &DHCPOptions{\n\t\tID:   o.DhcpOptionsId,\n\t\tName: findNameTag(o.Tags),\n\t\tTags: intersectTags(o.Tags, e.Tags),\n\t}\n\n\tfor _, s := range o.DhcpConfigurations {","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/dhcp_options.go#L50-L86","documentation":"Wraps AWS SDK errors from EC2 DescribeDhcpOptions during Find for the DHCPOptions task. kOps looks up existing DHCP options sets by name tag/filters; any API failure other than an empty result becomes this wrapped error.","triggerScenarios":"cloud.EC2().DescribeDhcpOptions fails: missing ec2:DescribeDhcpOptions IAM permission, invalid filter values, throttling, or connectivity/credential problems.","commonSituations":"Restricted IAM policies on kops controllers; stale credentials (InvalidClientTokenId); AWS throttling during large applies; region misconfiguration.","solutions":["Check the wrapped error in the message for the AWS error code","Grant ec2:DescribeDhcpOptions to the kOps IAM role","Verify AWS credentials and target region","Retry on throttling with backoff"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"aws ec2 describe-dhcp-options --filters Name=tag:Name,Values=$CLUSTER_NAME 2>&1 | head -1 # verifies perms + reachability before apply","typeGuard":"function isCredErr(err) { return err && ['InvalidClientTokenId','AuthFailure'].includes(err.code); }","tryCatchPattern":"try {\n  dhcp = findDHCPOptions(ctx, task);\n} catch (err) {\n  if (isCredErr(err)) fixCredentialsAndRetry();\n  else if (awsup.AWSErrorCode(err) === 'Throttling') backoffAndRetry();\n  else throw err;\n}","preventionTips":["Ensure ec2:DescribeDhcpOptions is in the kOps IAM policy","Verify credentials/region with aws sts get-caller-identity","Rate-limit applies on accounts prone to throttling"],"tags":["aws","ec2","dhcp-options","api-error"],"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"}