kubernetes/kops · error
expected exactly 1 DNS record with ID
Error message
expected exactly 1 DNS record with ID %s, got %d
What it means
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.
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
Example fix
// before (console) api.example.com. 300 IN A 1.2.3.4 api.example.com. 300 IN A 5.6.7.8 // duplicate — delete this // after (console) api.example.com. 300 IN A 1.2.3.4
Defensive patterns
Strategy: validation
Validate before calling
records, _ := cloud.DomainService().ListDNSZoneRecords(&domain.ListDNSZoneRecordsRequest{DNSZone: zone, Name: name, Type: rtype}, scw.WithContext(ctx))
if records.TotalCount > 1 && d.ID != nil {
return fmt.Errorf("cleanup required: %d duplicate %s records for %s in %s", records.TotalCount, rtype, name, zone)
} Try / catch
if records.TotalCount > 1 && d.ID != nil {
return fmt.Errorf("expected exactly 1 DNS record with ID %s, got %d — deduplicate records in the zone first", *d.ID, records.TotalCount)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- creating DNS record in zone
- error building DNS provider
- failed to delete record
- listing DNS records named
- updating DNS record ( )
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/488e28e598654f28.
Report an issue: GitHub.
Appendix: source
Thrown at upup/pkg/fi/cloudup/scalewaytasks/dns_record.go:64
}
func (d *DNSRecord) Find(context *fi.CloudupContext) (*DNSRecord, error) {
cloud := context.T.Cloud.(scaleway.ScwCloud)
records, err := cloud.DomainService().ListDNSZoneRecords(&domain.ListDNSZoneRecordsRequest{
ID: d.ID,
DNSZone: fi.ValueOf(d.DNSZone),
Name: fi.ValueOf(d.Name),
Type: domain.RecordType(fi.ValueOf(d.Type)),
}, scw.WithContext(context.Context()), scw.WithAllPages())
if err != nil {
return nil, fmt.Errorf("listing DNS records named %q in zone %q: %w", fi.ValueOf(d.Name), fi.ValueOf(d.DNSZone), err)
}
if records.TotalCount == 0 {
return nil, nil
}
if records.TotalCount > 1 && d.ID != nil {
return nil, fmt.Errorf("expected exactly 1 DNS record with ID %s, got %d", *d.ID, records.TotalCount)
}
recordFound := records.Records[0]
return &DNSRecord{
ID: new(recordFound.ID),
Name: new(recordFound.Name),
Data: new(recordFound.Data),
TTL: new(recordFound.TTL),
DNSZone: d.DNSZone,
Type: new(recordFound.Type.String()),
Lifecycle: d.Lifecycle,
}, nil
}
func (d *DNSRecord) Run(context *fi.CloudupContext) error {
return fi.CloudupDefaultDeltaRunMethod(d, context)
}
View on GitHub (pinned to 4c8573c808)