jeessy2/ddns-go · error

could not delete all %d records in a one request

Error message

could not delete all %d records in a one request

What it means

dns/spaceship.go deleteRecords() raises this when the number of IPs queued for deletion exceeds maxRecords, since deletion is sent as one batch request. It is a pre-flight guard in deleteRecords, called by updateRecord, preventing a partially-applied bulk delete.

Source

Thrown at dns/spaceship.go:191

		err = fmt.Errorf("could not fetch all %d records in a one request", response.Total)
		return
	}

	for _, item := range response.Items {
		if item.Type == recordType && item.Name == domain.SubDomain {
			ips = append(ips, item.Address)
		}
	}
	return
}

func (s *Spaceship) deleteRecords(recordType string, domain *config.Domain, ips []string) (err error) {
	if len(ips) == 0 {
		return
	}

	if len(ips) > maxRecords {
		err = fmt.Errorf("could not delete all %d records in a one request", len(ips))
		return
	}

	type Item struct {
		Type    string `json:"type"`
		Address string `json:"address"`
		Name    string `json:"name"`
	}
	var payload []Item
	for _, ip := range ips {
		payload = append(payload, Item{
			Type:    recordType,
			Address: ip,
			Name:    domain.SubDomain,
		})
	}
	data, err := json.Marshal(payload)
	if err != nil {

View on GitHub (pinned to 5874c2e666)

Solutions

  1. Manually delete duplicate records in the Spaceship dashboard to get under maxRecords
  2. Update the library to a version that chunks deletions into multiple requests
  3. Patch the code to delete in batches of maxRecords
  4. Add monitoring to catch duplicate-record growth before hitting the limit

Example fix

// before
if len(ips) > maxRecords {
	err = fmt.Errorf("could not delete all %d records in a one request", len(ips))
	return
}
// after (batched delete)
for len(ips) > 0 {
	batch := ips
	if len(batch) > maxRecords {
		batch = batch[:maxRecords]
	}
	if err := deleteBatch(batch); err != nil {
		return err
	}
	ips = ips[len(batch):]
}
Defensive patterns

Strategy: validation

Validate before calling

// preflight: count matching records before attempting bulk delete
if len(ips) > maxRecords {
	return fmt.Errorf("%d duplicate records exceed batch limit; clean up manually", len(ips))
}

Try / catch

if err != nil && strings.Contains(err.Error(), "could not delete all") {
	log.Printf("too many records to delete in one request: %v", err)
	return err
}

Prevention

When it happens

Trigger: updateRecord finding len(ips) > maxRecords stale records to delete — i.e., more matching duplicate records exist than the single-request delete limit allows.

Common situations: Zones that accumulated many duplicate A/AAAA records (e.g., DDNS ran for years without cleanup); a bug or previous failure that created repeated records for the same subdomain.

Related errors


AI-assisted analysis of jeessy2/ddns-go@5874c2e666 (2026-09-03). Data as JSON: /api/errors/81e2d762d7241809. Report an issue: GitHub.