jeessy2/ddns-go · error
paginated query failed at page %d: %w
Error message
paginated query failed at page %d: %w
What it means
After the keyword query finds no exact match, getDomainID falls back to paginating /domains?page=N&pageSize=100. If any page request fails at the HTTP/transport level (h.request returns error), this wrapped error reports which page failed. It is not raised for API-level (code!=0) errors — those produce 'paginated query API error'.
Source
Thrown at dns/hipmdnsmgr.go:286
}
// Check if exact match is found
for _, d := range domains {
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 {View on GitHub (pinned to 5874c2e666)
Solutions
- Check network connectivity/proxy settings between ddns-go and the DNSMgr host
- Increase the HTTP client timeout in config if the endpoint is slow
- Most importantly: ensure the configured domain matches exactly so the efficient keyword query (method 1) succeeds and pagination never runs
- Reduce domain count on the DNSMgr server or verify server stability/restart behavior
- Retry the DDNS run — transient network errors typically resolve on the next cycle
Example fix
// before (config domain mismatch triggers pagination fallback) Domain: "sub.example.org" # registered in DNSMgr as example.org only // after Domain: "sub.example.org" + register example.org in DNSMgr // or ensure exact domain entry exists so keyword search matches and fallback pagination is skipped
Defensive patterns
Strategy: retry
Validate before calling
// keep the domain registered and exactly named in DNSMgr so the fast keyword // query succeeds and fallback pagination never runs keywordURL := base + "/api/domains?page=1&pageSize=1&keyword=" + url.QueryEscape(domainName) resp, err := http.Get(keywordURL) // with auth header // if this returns the domain, the paginated fallback path is skipped entirely
Try / catch
if err != nil && strings.Contains(err.Error(), "paginated query failed") {
if isTransient(err) { // net.Error timeout, connection reset
time.Sleep(2 * time.Second)
retryOnce() // safe: reads only, idempotent
}
log.Printf("domain pagination aborted at page: %v", err)
} Prevention
- Register the exact domain in DNSMgr so keyword search matches (avoiding pagination entirely)
- Increase HTTP client timeout for slow self-hosted endpoints
- Keep domain count under one page (100) or ensure server uptime during DDNS cycles
- Use a stable network path (no flaky proxies) between ddns-go and DNSMgr
When it happens
Trigger: Transport failure during the fallback pagination loop: DNS timeout, connection refused/reset, TLS error, or proxy failure while fetching page N of /domains.
Common situations: Large number of domains forcing multi-page fallback walks that hit a flaky network or rate-limit-induced connection drop; self-hosted DNSMgr restarted mid-run; slow endpoint exceeding the http.Client timeout.
Related errors
- failed to get domain ID: %w
- failed to get record: %w
- 监听端口发生异常, 请检查端口是否被占用! %s
- 请求 dnsla 失败: %w
- 读取 dnsla 响应失败: %w
AI-assisted analysis of jeessy2/ddns-go@5874c2e666 (2026-09-03).
Data as JSON: /api/errors/e1939f5b2e77e26e.
Report an issue: GitHub.