{"record":{"id":"94b7304e3207244f","repo":"kubernetes/kops","slug":"failed-to-delete-record-s-w","errorCode":null,"errorMessage":"failed to delete record %s: %w","messagePattern":"failed to delete record (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/scaleway/cloud.go","lineNumber":543,"sourceCode":"func (s *scwCloudImplementation) DeleteDNSRecord(record *domain.Record, clusterName string) error {\n\tdomainName := strings.SplitN(clusterName, \".\", 2)[1]\n\trecordDeleteRequest := &domain.UpdateDNSZoneRecordsRequest{\n\t\tDNSZone: domainName,\n\t\tChanges: []*domain.RecordChange{\n\t\t\t{\n\t\t\t\tDelete: &domain.RecordChangeDelete{\n\t\t\t\t\tID: scw.StringPtr(record.ID),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\t_, err := s.domainAPI.UpdateDNSZoneRecords(recordDeleteRequest)\n\tif err != nil {\n\t\tif is404Error(err) {\n\t\t\tklog.V(8).Infof(\"DNS record %q (%s) was already deleted\", record.Name, record.ID)\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"failed to delete record %s: %w\", record.Name, err)\n\t}\n\treturn nil\n}\n\nfunc (s *scwCloudImplementation) DeleteLoadBalancer(loadBalancer *lb.LB) error {\n\tipsToRelease := loadBalancer.IP\n\n\t// We delete the load-balancer once it's in a stable state\n\t_, err := s.lbAPI.WaitForLb(&lb.ZonedAPIWaitForLBRequest{\n\t\tLBID: loadBalancer.ID,\n\t\tZone: s.zone,\n\t})\n\tif err != nil {\n\t\tif is404Error(err) {\n\t\t\tklog.V(8).Infof(\"Load-balancer %q (%s) was already deleted\", loadBalancer.Name, loadBalancer.ID)\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"waiting for load-balancer: %w\", err)","sourceCodeStart":525,"sourceCodeEnd":561,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/scaleway/cloud.go#L525-L561","documentation":"Wrap-around error returned by DeleteDNSRecord when the Scaleway Domains API UpdateDNSZoneRecords fails for a non-404 reason while removing a cluster's DNS record. 404 is explicitly treated as success (record already deleted); any other failure is wrapped with the record name and the SDK error via %w.","triggerScenarios":"UpdateDNSZoneRecords failure other than 404: DNS zone not found / not owned by the project (wrong dnsZone in cluster config), invalid record payload, IAM permission missing on the domain, API outage or rate limit.","commonSituations":"Cluster's DNS zone was deleted or moved to another project before teardown; kops principal lacks domains permissions; misconfigured `dnsZone` suffix in cluster spec; transient domains API failure during `kops delete cluster`.","solutions":["Verify the DNS zone exists and is in the same project: `scw dns zone list`.","Check IAM permissions of the kops principal for the domains API.","Reproduce the exact record-delete payload with `scw dns zone update-records` to see the raw API error.","Retry with backoff on 429/5xx; re-run `kops delete cluster` — 404s are already tolerated."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// verify DNS zone exists in this project before deleting records\n_, err := domain.NewAPI(client).ListDNSZones(&domain.ListDNSZonesRequest{ProjectID: projectID})\n// confirm the cluster's zone appears in the result","typeGuard":null,"tryCatchPattern":"if err := kopsDeleteCluster(); err != nil {\n  if strings.Contains(err.Error(), \"failed to delete record\") {\n    // inspect record/zone state; a re-run tolerates 404 (already deleted)\n    return nil // or log and continue teardown\n  }\n  return err\n}","preventionTips":["Keep the DNS zone in the same project/account as the cluster for the cluster's lifetime.","Grant the kops principal domains API write permissions.","Delete cluster resources before deleting/migrating the DNS zone."],"tags":["scaleway","dns","deletion","api-error"],"backgroundTag":"dns-record-deletion-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"}