Skip to content

Error Codes

Error response format

All GOVERN API errors use a consistent JSON structure:

{
"error": {
"type": "validation_error",
"message": "The 'model' field is required",
"code": "MISSING_REQUIRED_FIELD",
"param": "model",
"request_id": "req_01HXYZ"
}
}
FieldDescription
typeError category (see below)
messageHuman-readable description
codeMachine-readable error code
paramField that caused the error (validation errors)
request_idInclude this when contacting support

HTTP status codes

StatusMeaning
200Success
202Accepted (async operations)
400Bad request — invalid input
401Unauthorized — invalid or missing auth
403Forbidden — insufficient permissions
404Not found
409Conflict — duplicate resource
422Unprocessable — passed validation, blocked by policy
429Rate limit exceeded
500Internal server error
503Service unavailable (maintenance)

Error types and codes

Authentication errors (401)

CodeMessage
INVALID_API_KEYThe API key provided is invalid
EXPIRED_API_KEYThe API key has expired
MISSING_AUTHNo authorization header provided
TOKEN_EXPIREDJWT has expired
INVALID_TOKENJWT signature verification failed

Authorization errors (403)

CodeMessage
INSUFFICIENT_PERMISSIONSAPI key does not have required scope
IP_NOT_ALLOWEDRequest from IP not in allowlist
ORG_SUSPENDEDOrganization account is suspended
PLAN_LIMIT_EXCEEDEDFeature not available on current plan

Validation errors (400)

CodeMessage
MISSING_REQUIRED_FIELDRequired field is missing
INVALID_FIELD_TYPEField has wrong type
INVALID_ENUM_VALUEField value not in allowed list
FIELD_TOO_LONGField exceeds maximum length
INVALID_JSONRequest body is not valid JSON

Policy violations (422)

CodeMessage
GOVERN_POLICY_VIOLATIONInference blocked by governance policy
BUDGET_EXCEEDEDHourly token or spend budget exhausted

Rate limit errors (429)

CodeMessage
RATE_LIMIT_EXCEEDEDToo many requests — see Retry-After header
BURST_LIMIT_EXCEEDEDBurst capacity exceeded

Server errors (500)

CodeMessage
INTERNAL_ERRORUnexpected server error
SCORING_FAILEDAssessment could not be completed
UPSTREAM_ERRORError communicating with scoring backend

SDK error handling

The TypeScript SDK exposes typed error classes:

import {
GovernError,
GovernAuthError,
GovernRateLimitError,
GovernValidationError,
GovernPolicyViolationError,
} from '@archetypal-ai/govern';
try {
const result = await govern.assess(input);
} catch (error) {
if (error instanceof GovernAuthError) {
// 401/403 — check API key
console.error('Auth error:', error.code);
} else if (error instanceof GovernRateLimitError) {
// 429 — back off
await sleep(error.retryAfterMs);
} else if (error instanceof GovernValidationError) {
// 400 — fix the input
console.error('Validation error on field:', error.param);
} else if (error instanceof GovernPolicyViolationError) {
// 422 — inference blocked by policy
console.error('Policy violations:', error.violations);
} else if (error instanceof GovernError) {
// Other GOVERN error
console.error('GOVERN error:', error.requestId);
}
}

Getting support

When contacting support, always include the request_id from the error response. This allows our team to look up the full request trace.

Email: support@archetypal.ai Dashboard: govern.archetypal.ai/support Status page: status.govern.archetypal.ai