jeessy2/ddns-go · error

could not fetch all %d records in a one request

Error message

could not fetch all %d records in a one request

What it means

dns/spaceship.go getRecords() fails with this when the domain's total record count exceeds maxRecords, because the library fetches all DNS records in a single page and cannot guarantee completeness. It is raised before any record filtering, and propagates to updateRecord.

Source

Thrown at dns/spaceship.go:173

	type Response struct {
		Items []Item `json:"items"`
		Total int    `json:"total"`
	}

	resp, err := s.request(domain, "GET", url.Values{"take": {strconv.Itoa(maxRecords)}, "skip": {"0"}}, []byte{})
	if err != nil {
		return
	}

	var response Response
	err = json.Unmarshal(resp, &response)
	if err != nil {
		return
	}

	if response.Total > maxRecords {
		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))

View on GitHub (pinned to 5874c2e666)

Solutions

  1. Reduce the number of DNS records in the zone (delete stale entries) so a single page suffices
  2. Update the library to a version raising maxRecords or adding pagination
  3. Use a dedicated subdomain zone with fewer records for DDNS
  4. Fork and implement paginated fetching for large zones

Example fix

// before (library limit)
if response.Total > maxRecords {
	err = fmt.Errorf("could not fetch all %d records in a one request", response.Total)
	return
}
// after (workaround: clean up zone)
# delete stale records in Spaceship dashboard until Total <= maxRecords, then re-run
Defensive patterns

Strategy: validation

Validate before calling

// cannot query Total beforehand; guard by keeping zone small
// skip DDNS for zones known to exceed the limit
if zoneRecordCount(domain) > maxRecords {
	return fmt.Errorf("skip %s: zone exceeds single-request limit", domain.DomainName)
}

Try / catch

if err != nil && strings.Contains(err.Error(), "could not fetch all") {
	log.Printf("zone too large for single-page fetch: %v — reduce record count", err)
	return err
}

Prevention

When it happens

Trigger: updateRecord on a Spaceship domain whose account/zone has more records than maxRecords, so a single-page getRecords response cannot contain every record (response.Total > maxRecords).

Common situations: Domains with hundreds of legacy DNS records; shared zones managed by many services; using the library against an enterprise zone with heavy record churn.

Related errors


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