kubernetes/kops · error

updating DNS record %q (%s): %w

Error message

updating DNS record %q (%s): %w

What it means

In RenderScw for the DNS record task, the Scaleway Domain API UpdateDNSZoneRecords call failed while applying a 'set' change to an existing record (updating its data/TTL). The record name and ID identify the existing DNS entry being modified; the wrapped error is the SDK response, e.g. zone not found, permissions, or invalid record data.

Source

Thrown at upup/pkg/fi/cloudup/scalewaytasks/dns_record.go:133

	if actual != nil {
		recordUpdated, err := t.Cloud.DomainService().UpdateDNSZoneRecords(&domain.UpdateDNSZoneRecordsRequest{
			DNSZone: fi.ValueOf(actual.DNSZone),
			Changes: []*domain.RecordChange{
				{
					Set: &domain.RecordChangeSet{
						ID: actual.ID,
						Records: []*domain.Record{
							{
								Data: fi.ValueOf(expected.Data),
								TTL:  fi.ValueOf(expected.TTL),
							},
						},
					},
				},
			},
		})
		if err != nil {
			return fmt.Errorf("updating DNS record %q (%s): %w", fi.ValueOf(actual.Name), fi.ValueOf(actual.ID), err)
		}
		expected.ID = &recordUpdated.Records[0].ID
		return nil
	}

	recordCreated, err := t.Cloud.DomainService().UpdateDNSZoneRecords(&domain.UpdateDNSZoneRecordsRequest{
		DNSZone: fi.ValueOf(expected.DNSZone),
		Changes: []*domain.RecordChange{
			{
				Add: &domain.RecordChangeAdd{
					Records: []*domain.Record{
						{
							Data: fi.ValueOf(expected.Data),
							Name: fi.ValueOf(expected.Name),
							TTL:  fi.ValueOf(expected.TTL),
							Type: domain.RecordType(fi.ValueOf(expected.Type)),
						},
					},

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify the record ID still exists; if it was deleted, re-run kops update cluster so it is recreated
  2. Validate the record Data format matches its Type (A needs IPv4, CNAME a hostname)
  3. Ensure credentials have domain write permission on the zone
  4. Check the DNS zone name is still valid and active

Example fix

// before
Data: "300.1.2.3"   // invalid for A record
// after
Data: "1.2.3.4"
Defensive patterns

Strategy: try-catch

Validate before calling

// validate record data matches type before update
switch domain.RecordType(fi.ValueOf(expected.Type)) {
case domain.RecordTypeA:
	if net.ParseIP(fi.ValueOf(expected.Data)) == nil || strings.Contains(fi.ValueOf(expected.Data), ":") {
		return fmt.Errorf("invalid A record data %q", fi.ValueOf(expected.Data))
	}
}

Type guard

func isNotFound(err error) bool {
	var rerr *scw.ResponseError
	return errors.As(err, &rerr) && rerr.StatusCode == 404
}

Try / catch

if err != nil {
	var rerr *scw.ResponseError
	if errors.As(err, &rerr) && rerr.StatusCode == 404 {
		// record deleted out-of-band: fall back to create path
		return d.RenderScw(t, nil, expected, changes)
	}
	return fmt.Errorf("updating DNS record %q (%s): %w", name, id, err)
}

Prevention

When it happens

Trigger: The UpdateDNSZoneRecords call with a Set change fails — typically because the record ID no longer exists (record deleted out-of-band), the DNS zone changed/invalid, or the new Data/TTL value is rejected by the API (e.g. invalid data for the record type).

Common situations: Record deleted manually in the console between Find and update (stale ID), concurrent kOps runs, invalid record data (e.g. malformed A value or wrong CNAME target), or IAM write permission missing.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/1a421d944798d6e7. Report an issue: GitHub.