jeessy2/ddns-go · error

paginated query API error at page %d: %s

Error message

paginated query API error at page %d: %s

What it means

getDomainID paginates GET /domains looking for the domain whose name matches domainName. When the provider response carries a non-zero business Code, the page-level query itself is considered failed and this error wraps the provider's Msg with the page number, aborting the lookup for updateRecord.

Source

Thrown at dns/hipmdnsmgr.go:290

		if d.Name == domainName {
			return d.ID, nil
		}
	}

	// Method 2: If keyword query not found, use list matching as fallback (compatible with old API)
	// Paginate through all domains to find the target
	const pageSize = 100
	currentPage := 1

	for {
		path := fmt.Sprintf("/domains?page=%d&pageSize=%d", currentPage, pageSize)
		apiResp, err := h.request(baseURL, apiToken, "GET", path, nil)
		if err != nil {
			return 0, fmt.Errorf("paginated query failed at page %d: %w", currentPage, err)
		}

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

		// Parse response with smart format detection
		var pageDomains []DnsMgrDomain
		var total int

		var rawData interface{}
		if err := json.Unmarshal(apiResp.Data, &rawData); err == nil {
			switch v := rawData.(type) {
			case []interface{}:
				jsonData, _ := json.Marshal(v)
				json.Unmarshal(jsonData, &pageDomains)
			case map[string]interface{}:
				if listData, ok := v["list"]; ok {
					jsonData, _ := json.Marshal(listData)
					json.Unmarshal(jsonData, &pageDomains)
				}
				if totalData, ok := v["total"]; ok {

View on GitHub (pinned to 5874c2e666)

Solutions

  1. Log/review apiResp.Msg for the real provider reason and fix the underlying cause (token, permissions, quota)
  2. Verify the API token is valid and not expired by making a simple provider call
  3. Check provider status page for an outage and retry later
  4. Add backoff/retry around the paginated scan to survive transient rate limits

Example fix

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

Strategy: try-catch

Validate before calling

// Go: verify token works before paginating
if err := pingProvider(baseURL, apiToken); err != nil {
    return fmt.Errorf("provider unreachable or token invalid: %w", err)
}

Try / catch

id, err := mgr.getDomainID(baseURL, token, domain)
if err != nil {
    if strings.Contains(err.Error(), "API error at page") {
        // provider rejected a page; inspect msg, backoff and retry
    }
    return err
}

Prevention

When it happens

Trigger: The DNS provider returns apiResp.Code != 0 while fetching one of the domain-list pages during getDomainID (e.g. auth/token rejection, rate limit, server-side error on that page).

Common situations: Expired or revoked API token, provider rate limiting during the paged scan (up to 10 pages), transient provider outage, or an account that no longer has domain-list permission.

Related errors


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