{"record":{"id":"51a71ced7c2f6524","repo":"kubernetes/kops","slug":"failed-to-list-records-for-domain-s-s","errorCode":null,"errorMessage":"failed to list records for domain %s: %s","messagePattern":"failed to list records for domain (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/digitalocean/resources.go","lineNumber":161,"sourceCode":"\tdomains, _, err := c.DomainService().List(context.TODO(), &godo.ListOptions{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to list domains: %s\", err)\n\t}\n\n\tvar domainName string\n\tfor _, domain := range domains {\n\t\tif strings.HasSuffix(clusterName, domain.Name) {\n\t\t\tdomainName = domain.Name\n\t\t}\n\t}\n\n\tif domainName == \"\" {\n\t\treturn nil, fmt.Errorf(\"failed to find domain for cluster: %s\", clusterName)\n\t}\n\n\trecords, err := getAllRecordsByDomain(c, domainName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to list records for domain %s: %s\", domainName, err)\n\t}\n\n\tvar resourceTrackers []*resources.Resource\n\tfor _, record := range records {\n\t\tif !strings.HasSuffix(dns.EnsureDotSuffix(record.Name)+domainName, clusterName) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// kops for digitalocean should only create A records\n\t\t// in the future that may change but for now this provides a safe filter\n\t\t// in case users assign NS records for the cluster subdomain\n\t\tif record.Type != \"A\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tresourceTracker := &resources.Resource{\n\t\t\tName: record.Name,\n\t\t\tID:   strconv.Itoa(record.ID),","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/digitalocean/resources.go#L143-L179","documentation":"Wraps an error from getAllRecordsByDomain when fetching all DNS records for the matched domain. The domain lookup succeeded but enumerating its records failed, so kOps cannot discover cluster DNS resources.","triggerScenarios":"getAllRecordsByDomain paginates godo DomainRecordsService().List; any API error (auth, network, rate limit) during pagination for domainName is wrapped here.","commonSituations":"Token read scope on domains granted but records listing blocked by permission changes; rate limiting when many records; transient network drop mid-pagination.","solutions":["Check the wrapped error for 401/429 and fix token scope or wait for rate-limit reset","Retry the delete/dump operation","Verify domain still exists in the DO account (it may have been deleted between calls)","Check network connectivity to api.digitalocean.com"],"exampleFix":"// before\n# 429 rate limit hit during record pagination\n// after\nexport DIGITALOCEAN_ACCESS_TOKEN=<token with adequate limits>\nkops delete cluster --name my.cluster --cloud digitalocean  # retry after backoff","handlingStrategy":"retry","validationCode":"records, err := getAllRecordsByDomain(c, domainName)\nif err != nil {\n\tif isRetryable(err) { records, err = retryWithBackoff(3, func() ([]do.Record, error) { return getAllRecordsByDomain(c, domainName) }) }\n}","typeGuard":null,"tryCatchPattern":"records, err := getAllRecordsByDomain(c, domainName)\nif err != nil {\n\treturn fmt.Errorf(\"failed to list records for domain %s: %w\", domainName, err)\n}","preventionTips":["Use backoff on 429 rate-limit errors during pagination","Ensure token keeps domain read scope throughout the operation","Avoid deleting the domain between listing and record fetching"],"tags":["digitalocean","dns","api-rate-limit"],"backgroundTag":"digitalocean-api-error","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"}