jeessy2/ddns-go · error

paginated record query API error at page %d: %s

Error message

paginated record query API error at page %d: %s

What it means

When the provider answers a records page with a non-zero business Code, getRecord treats the page as failed and surfaces the provider's Msg tagged with the page number. The record search for updateRecord aborts.

Source

Thrown at dns/hipmdnsmgr.go:355

}

// getRecord Get DNS record
// Paginate through all records to find the target
func (h *HiPMDnsMgr) getRecord(baseURL, apiToken string, domainID int, subDomain, recordType string) (*DnsMgrRecord, error) {
	const pageSize = 100
	currentPage := 1

	for {
		path := fmt.Sprintf("/domains/%d/records?page=%d&pageSize=%d&subdomain=%s&type=%s",
			domainID, currentPage, pageSize, subDomain, recordType)

		apiResp, err := h.request(baseURL, apiToken, "GET", path, nil)
		if err != nil {
			return nil, fmt.Errorf("paginated record query failed at page %d: %w", currentPage, err)
		}

		if apiResp.Code != 0 {
			return nil, fmt.Errorf("paginated record query API error at page %d: %s", currentPage, apiResp.Msg)
		}

		var recordList DnsMgrRecordList
		if err := json.Unmarshal(apiResp.Data, &recordList); err != nil {
			return nil, fmt.Errorf("failed to parse record list: %w", err)
		}

		// Find matching record in current page
		for _, r := range recordList.List {
			if r.Name == subDomain && r.Type == recordType {
				return &r, nil
			}
		}

		// Check if we've reached the end
		if len(recordList.List) < pageSize || (recordList.Total > 0 && currentPage*pageSize >= recordList.Total) {
			break
		}

View on GitHub (pinned to 5874c2e666)

Solutions

  1. Read apiResp.Msg in the error string for the exact provider reason
  2. Confirm the domainID (from getDomainID) is still valid on the provider
  3. Verify token permissions for record read access
  4. Retry after backoff if the Msg indicates throttling

Example fix

// before
return nil, fmt.Errorf("paginated record query API error at page %d: %s", currentPage, apiResp.Msg)
// after
return nil, fmt.Errorf("paginated record query API error at page %d (code=%d): %s", currentPage, apiResp.Code, apiResp.Msg)
Defensive patterns

Strategy: try-catch

Validate before calling

// Go: re-validate domainID before record scan
if domainID <= 0 { return errors.New("invalid domainID; refresh via getDomainID") }

Try / catch

rec, err := mgr.getRecord(baseURL, token, domainID, sub, rtype)
if err != nil && strings.Contains(err.Error(), "API error at page") {
    // parse provider msg; if code indicates stale domain, refresh domainID and retry once
    domainID, derr := mgr.getDomainID(baseURL, token, domain)
    if derr == nil { rec, err = mgr.getRecord(baseURL, token, domainID, sub, rtype) }
}

Prevention

When it happens

Trigger: apiResp.Code != 0 on a GET /domains/{id}/records page — invalid domainID, token lacking record-read permission, rate limit, or provider-side error on that specific page.

Common situations: Stale domainID from a domain deleted/recreated, token permission changes, provider rate limiting during large record scans.

Related errors


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