jeessy2/ddns-go · error

domain %s not found

Error message

domain %s not found

What it means

After scanning up to 10 pages (1000 domains) the library never found a domain whose name equals domainName, so getDomainID returns 0 with this error. It is a not-found sentinel for the domain being updated via updateRecord.

Source

Thrown at dns/hipmdnsmgr.go:336

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

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

		currentPage++

		// Safety limit: stop after 10 pages (1000 domains)
		if currentPage > 10 {
			break
		}
	}

	return 0, fmt.Errorf("domain %s not found", domainName)
}

// 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 {

View on GitHub (pinned to 5874c2e666)

Solutions

  1. Check the exact domain name spelling in your configuration against the provider dashboard
  2. Confirm the domain exists under the account owning the API token
  3. If the account has >1000 domains, raise the page limit or query the specific domain endpoint directly
  4. Re-check the domain registration/expiry status with the provider

Example fix

// before
id, err := mgr.getDomainID(baseURL, token, "example.con")
// after
id, err := mgr.getDomainID(baseURL, token, "example.com") // verify name on provider dashboard
Defensive patterns

Strategy: validation

Validate before calling

// Go: confirm domain exists before calling updateRecord
var found bool
for _, d := range listAllDomains(baseURL, token) {
    if d.Name == domainName { found = true; break }
}
if !found { return fmt.Errorf("domain %q not in account; check spelling/account", domainName) }

Type guard

func domainExists(domains []DnsMgrDomain, name string) bool {
    for _, d := range domains {
        if d.Name == name { return true }
    }
    return false
}

Prevention

When it happens

Trigger: domainName passed to getDomainID does not match any domain returned by the provider's paginated domain list (case/typo mismatch, domain belongs to another account, or provider returns only the first 1000 domains).

Common situations: Typo in the configured FQDN, domain registered under a different provider account, domain recently deleted/expired, or more than 1000 domains in the account so the safety limit truncates the scan before reaching it.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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