{"record":{"id":"488e28e598654f28","repo":"kubernetes/kops","slug":"expected-exactly-1-dns-record-with-id-s-got-d","errorCode":null,"errorMessage":"expected exactly 1 DNS record with ID %s, got %d","messagePattern":"expected exactly 1 DNS record with ID (.+?), got (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/scalewaytasks/dns_record.go","lineNumber":64,"sourceCode":"}\n\nfunc (d *DNSRecord) Find(context *fi.CloudupContext) (*DNSRecord, error) {\n\tcloud := context.T.Cloud.(scaleway.ScwCloud)\n\trecords, err := cloud.DomainService().ListDNSZoneRecords(&domain.ListDNSZoneRecordsRequest{\n\t\tID:      d.ID,\n\t\tDNSZone: fi.ValueOf(d.DNSZone),\n\t\tName:    fi.ValueOf(d.Name),\n\t\tType:    domain.RecordType(fi.ValueOf(d.Type)),\n\t}, scw.WithContext(context.Context()), scw.WithAllPages())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"listing DNS records named %q in zone %q: %w\", fi.ValueOf(d.Name), fi.ValueOf(d.DNSZone), err)\n\t}\n\n\tif records.TotalCount == 0 {\n\t\treturn nil, nil\n\t}\n\tif records.TotalCount > 1 && d.ID != nil {\n\t\treturn nil, fmt.Errorf(\"expected exactly 1 DNS record with ID %s, got %d\", *d.ID, records.TotalCount)\n\t}\n\trecordFound := records.Records[0]\n\n\treturn &DNSRecord{\n\t\tID:        new(recordFound.ID),\n\t\tName:      new(recordFound.Name),\n\t\tData:      new(recordFound.Data),\n\t\tTTL:       new(recordFound.TTL),\n\t\tDNSZone:   d.DNSZone,\n\t\tType:      new(recordFound.Type.String()),\n\t\tLifecycle: d.Lifecycle,\n\t}, nil\n}\n\nfunc (d *DNSRecord) Run(context *fi.CloudupContext) error {\n\treturn fi.CloudupDefaultDeltaRunMethod(d, context)\n}\n","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/scalewaytasks/dns_record.go#L46-L82","documentation":"Find filters records by ID but the zone query returned more than one record while a specific record ID was requested. Since Scaleway record IDs are unique, more than one match means inconsistent state, so Find refuses to guess and returns an error.","triggerScenarios":"ListDNSZoneRecords returned TotalCount > 1 while d.ID != nil — i.e. the zone contains multiple records matching the requested name/type, and the request asked to narrow to a single known ID.","commonSituations":"Duplicate DNS records created by earlier failed kOps runs or manual console edits (same name/type added twice), or records left behind after a zone import.","solutions":["Inspect the zone and delete the duplicate record in the Scaleway console (scw domain record list zone-name=<zone>)","Keep only one record per name/type pair, then re-run kops update cluster","If intentional round-robin is needed, remove the ID from the kOps task so it does not expect a single match"],"exampleFix":"// before (console)\napi.example.com. 300 IN A 1.2.3.4\napi.example.com. 300 IN A 5.6.7.8   // duplicate — delete this\n// after (console)\napi.example.com. 300 IN A 1.2.3.4","handlingStrategy":"validation","validationCode":"records, _ := cloud.DomainService().ListDNSZoneRecords(&domain.ListDNSZoneRecordsRequest{DNSZone: zone, Name: name, Type: rtype}, scw.WithContext(ctx))\nif records.TotalCount > 1 && d.ID != nil {\n\treturn fmt.Errorf(\"cleanup required: %d duplicate %s records for %s in %s\", records.TotalCount, rtype, name, zone)\n}","typeGuard":null,"tryCatchPattern":"if records.TotalCount > 1 && d.ID != nil {\n\treturn fmt.Errorf(\"expected exactly 1 DNS record with ID %s, got %d — deduplicate records in the zone first\", *d.ID, records.TotalCount)\n}","preventionTips":["Avoid manual record edits in the console on kOps-managed zones","Run only one kops update at a time to prevent duplicate creation races","Periodically deduplicate name/type pairs in managed zones"],"tags":["scaleway","dns","duplicate-record","state"],"backgroundTag":"duplicate-resource-state","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"}