domain
Reference

Errors

Handle Domain0 API, transport, protocol, and validation failures.

The SDK separates four failure boundaries:

ErrorMeaning
z.ZodErrorYour local input does not match a public contract
Domain0TransportErrorThe request could not reach Domain0
Domain0ProtocolErrorThe response was not valid Domain0 JSON
Domain0ErrorDomain0 returned a valid public API error
try {
  await platform.getConnection(connectionId)
} catch (error) {
  if (error instanceof Domain0Error) {
    const { code, requestId, retryable } = error.response.error
    console.error({ code, requestId, retryable })
  }
}

API error codes

CodeMeaningRecommended action
invalid_requestInput failed validationFix the request; do not retry unchanged input
unauthorizedAuthentication is missing or invalidReplace the server key or refresh browser access
forbiddenThe credential cannot access this resource or originCheck application ownership, connection scope, and exact origin
not_foundThe application-owned resource does not existVerify the saved ID; create a new connection when appropriate
conflictThe command does not match current connection stateRetrieve current state before choosing the next action
rate_limitedThe request rate is too highWait for the response retry guidance before retrying
dns_unavailableAuthoritative DNS evidence is temporarily unavailableRetry only when retryable is true
provider_unavailableThe selected provider path is temporarily unavailableRetry or continue through guided setup
provider_authorization_failedProvider consent or credentials were rejectedLet the customer authorize again
provider_limitationThe provider cannot perform the requested automatic operationUse the guided provider path
plan_expiredThe reviewed DNS plan is no longer currentPrepare and review a fresh plan
propagation_pendingRequired records are not yet authoritative everywhereKeep the connection and verify again later
internal_errorDomain0 could not complete the operationRetry only when retryable is true and retain requestId

Safe logging

Log the error code, HTTP status, requestId, connection ID, and operation name. Never log API keys, browser bearer tokens, webhook secrets, signatures, or provider credential fields.

On this page