Errors
The single ulex error envelope: type, code, message, param, request_id, retryable, docs_url, hint, details. Every error code with its HTTP status, whether it is retryable, its causes, and its fix.
Every surface — REST, MCP, CLI, and webhook delivery failures — returns the same object. You learn one grammar.
{
"error": {
"type": "conflict_error",
"code": "resource_exists",
"message": "A organization with that slug already exists.",
"param": "slug",
"request_id": "req_01M3PSW9R0175NAW62NYR403R8",
"retryable": false,
"docs_url": "https://docs.ulexid.com/api-reference/errors",
"hint": "Reuse the existing organization id, or choose a different slug.",
"details": { "slug": "already taken" }
}
}#Fields
| Field | Type | Always present | Use it for |
|---|---|---|---|
type | enum | yes | choosing the HTTP status family, and coarse branching |
code | enum | yes | the exact failure. Branch on this, not on message |
message | string | yes | humans. Never parse it |
param | string | no | the offending request field. Map it back to your form/input |
request_id | string | yes | quote it in a bug report; it is in the audit log |
retryable | boolean | yes | the only thing you need for backoff |
docs_url | string | no | a deep link to the relevant page |
hint | string | no | the next action. On 429s this is "Retry after 17s." |
details | Record<string, string | string[]> | no | per-field validation messages |
#Type to status
type | Status | Retryable? | Meaning |
|---|---|---|---|
invalid_request_error | 400 | no | the request is wrong |
authentication_error | 401 | no | credential missing, wrong, expired, revoked |
permission_error | 403 | no | authenticated, not allowed |
not_found_error | 404 | no | no such resource in this tenant |
conflict_error | 409 | no | state conflict |
rate_limited | 429 | no | request shield blocked this source IP; honor Retry-After |
api_error | 500 | yes | our fault |
Status overrides: service_unavailable → 503, timeout → 504, domain_not_verified → 412, scim_bulk_exceeded → 413, scim_user_not_found → 404, scim_group_not_found → 404, deployment_not_found → 404, invalid_state_transition → 409, webhook_url_blocked → 400, saml_clock_skew → 400, and all the OAuth interaction codes (mfa_required, step_up_required, login_required, interaction_required, consent_required, account_selection_required, token_expired, api_key_expired) → 401.
#retryable
A closed set. Nothing else is ever retryable.
code | retryable | Why |
|---|---|---|
internal_error | true | transient server fault |
service_unavailable | true | deploying, draining, or degraded |
timeout | true | upstream did not answer in time |
webhook_delivery_failed | true | delivery-side, not caller-side |
deployment_failed | true | the deployment subsystem retried internally |
scim_bulk_failed | true | partial bulk; the remaining operations were skipped |
| everything else | false | retrying cannot help |
#Backoff
attempt = 0
loop:
result = call(request)
if not an error envelope: return result
if result.error.retryable is false: return result
attempt += 1
if attempt > 5: return result
if result.status == 429:
wait = seconds from the `Retry-After` response header
elif attempt <= 2: wait = 0.5 * attempt
else: wait = 2 ** (attempt - 2)
sleep(wait)Cap total retry time at 30 seconds. Add jitter of up to 20% so a fleet of agents does not resynchronise.
#Error codes
#Generic
code | Status | type | Retryable | Cause → fix |
|---|---|---|---|---|
invalid_request | 400 | invalid_request_error | no | malformed body or query → fix the field named in param |
invalid_json | 400 | invalid_request_error | no | body is not parseable JSON → check for a trailing comma, a smart quote, a ${} that was never substituted |
missing_parameter | 400 | invalid_request_error | no | a required field is absent → param names it |
unknown_parameter | 400 | invalid_request_error | no | a field you sent is not in the schema → most often environment. Objects are strict; extra keys are rejected on purpose so typos surface |
validation_failed | 400 | invalid_request_error | no | a field failed its schema → details maps field path to message |
internal_error | 500 | api_error | yes | our bug → retry up to 5 times, then GET /status and report the request_id |
service_unavailable | 503 | api_error | yes | deploying or draining → retry with backoff |
timeout | 504 | api_error | yes | upstream exceeded the deadline → retry; if it persists, lower limit or narrow the filter |
#Authentication and authorization
code | Status | type | Cause → fix |
|---|---|---|---|
unauthenticated | 401 | authentication_error | no Authorization header → add one |
invalid_api_key | 401 | authentication_error | malformed key, wrong length, or stray whitespace → copy the full value |
api_key_expired | 401 | authentication_error | past expires_at → mint a new one |
api_key_revoked | 401 | authentication_error | revoked → mint a new one; do not retry |
invalid_token | 401 | authentication_error | not a JWT, wrong issuer, or bad signature → check iss equals https://ulexid.com (or your local issuer) |
token_expired | 401 | authentication_error | exp in the past → refresh, or re-login if no refresh token |
token_revoked | 401 | authentication_error | revoked explicitly, or refresh-token family reuse → restart the flow |
insufficient_scope | 403 | permission_error | scope missing → read hint for the exact scope |
cross_tenant | 403 | permission_error | the resource belongs to another tenant → you cannot see it; treat as 404 in your UI |
invalid_client | 401 | authentication_error | unknown client_id |
invalid_grant | 400 | authentication_error | the authorization code is expired, already consumed, or the redirect_uri does not match → re-login, do not retry |
unauthorized_client | 403 | permission_error | the grant type is not enabled on the application |
unsupported_grant_type | 400 | invalid_request_error | add the grant to the application's grant_types |
invalid_redirect_uri | 400 | invalid_request_error | not in the application's redirect_uris → copy the exact string; a trailing slash is a different URI |
invalid_request_uri | 400 | invalid_request_error | request_uri JARM is not enabled |
invalid_pkce_verifier | 400 | invalid_request_error | does not match the stored challenge |
code_verifier_mismatch | 400 | invalid_request_error | PKCE S256 mismatch → recompute code_challenge = base64url(sha256(code_verifier)) |
invalid_state | 400 | invalid_request_error | state did not round-trip → your session lost it |
invalid_nonce | 400 | invalid_request_error | nonce did not round-trip |
session_expired | 401 | authentication_error | idle or absolute timeout |
password_policy_not_met | 400 | invalid_request_error | does not meet the tenant's authPolicy.password → read error.message, which names every unmet rule at once |
access_denied | 403 | permission_error | suspended user, source in blocked_ip_ranges, direct sign-in attempted when organization.sso_only is true, or joining with an unverified domain when allow_profiles_outside_organization is false |
login_required | 401 | authentication_error | prompt=none and no session → re-run without prompt=none |
interaction_required | 401 | authentication_error | prompt=none and interaction is required |
consent_required | 401 | authentication_error | the person holds a session but has not approved the scopes this application asked for. prompt=none forbids showing the approval screen |
account_selection_required | 401 | authentication_error | multiple accounts, no session |
mfa_required | 401 | authentication_error | MFA challenge outstanding → call ulex_simulate_mfa with mode: "satisfy", or present the challenge to a human |
step_up_required | 401 | authentication_error | acr_values demanded more than the session has |
#Resources
code | Status | type | Cause → fix |
|---|---|---|---|
not_found | 404 | not_found_error | no such id in this tenant → check the prefix (org_, usr_, con_, …) |
resource_exists | 409 | conflict_error | slug, email, or name collision → reuse the id, or pass an Idempotency-Key |
resource_deleted | 409 | conflict_error | soft-deleted; within the 30-day restore window it is still in the audit log but not readable |
immutable_field | 409 | conflict_error | you tried to change id, slug, object, or created_at |
limit_reached | 400 | invalid_request_error | array at capacity — 50 redirect URIs, 500 domains, 20 ACS URLs, 200 blocked IP ranges |
#SSO, SAML, SCIM
code | Status | type | Cause → fix |
|---|---|---|---|
saml_request_invalid | 400 | invalid_request_error | the AuthnRequest is not well-formed XML, or the SAMLRequest is not correctly deflated and base64-encoded |
saml_response_invalid | 400 | invalid_request_error | the Response is malformed, or Destination does not equal the ACS URL |
saml_signature_invalid | 400 | invalid_request_error | the signature does not verify against the connection's certificate → POST /connections/{id}/verify, then re-upload the cert |
saml_nameid_mismatch | 400 | invalid_request_error | the NameID does not resolve to a user and allow_link is false |
saml_acs_mismatch | 400 | invalid_request_error | InResponseTo does not match an outstanding request, or the ACS URL is not in acs_allowed_urls |
saml_replay_detected | 400 | invalid_request_error | this assertion ID has already been consumed → a replay, or the IdP retried. Both are legitimate; ulex rejects the second |
saml_clock_skew | 400 | invalid_request_error | NotOnOrAfter is outside allowed_clock_skew_seconds (default 120) → sync clocks or raise the tolerance to at most 600 |
scim_invalid_filter | 400 | invalid_request_error | the filter parameter is not valid SCIM filtering syntax |
scim_invalid_syntax | 400 | invalid_request_error | the body is not valid SCIM JSON |
scim_conflict | 409 | conflict_error | userName or externalId already exists in this directory |
scim_user_not_found | 404 | not_found_error | no user with that id |
scim_group_not_found | 404 | not_found_error | no group with that id |
scim_bulk_failed | 500 | api_error | a Bulk operation failed → read Operations[].response.status |
scim_bulk_exceeded | 413 | invalid_request_error | more than 100 operations in one Bulk request |
directory_not_synced | 409 | conflict_error | you read sync state before the first run completed → trigger a sync first |
#Domains
code | Status | type | Cause → fix |
|---|---|---|---|
domain_not_verified | 412 | invalid_request_error | POST /organizations/{id}/domains/{domainId}/verify, or publish the TXT record when allow_mocks is false |
sso_domain_required | 409 | conflict_error | removing the last verified domain of an sso_only org → verify a replacement first, or set sso_only to false |
domain_already_verified | 409 | conflict_error | already verified → this is a no-op, not a failure |
domain_verification_failed | 500 | api_error | the lookup itself failed → retry |
#Webhooks
code | Status | type | Cause → fix |
|---|---|---|---|
webhook_url_invalid | 400 | invalid_request_error | not an https:// URL, or contains credentials |
webhook_url_blocked | 400 | invalid_request_error | SSRF guard: loopback, link-local, RFC 1918, or a blocked metadata endpoint |
webhook_delivery_failed | 500 | api_error | delivery-side. Your endpoint is not answering 2xx within 5 seconds |
webhook_signature_invalid | 400 | invalid_request_error | your receiver rejected a signature → check the Ulex-Signature construction and the secret |
#Deployments and jobs
code | Status | type | Cause → fix |
|---|---|---|---|
deployment_failed | 500 | api_error | read deployment.error.code; retryable says whether a re-run can work |
deployment_not_found | 404 | not_found_error | no deployment with that id |
invalid_state_transition | 409 | conflict_error | e.g. cancelling a succeeded deployment → read state first |
job_cancelled | 409 | conflict_error | a running job was cancelled |
#MCP
code | Status | type | Cause → fix |
|---|---|---|---|
mcp_unauthorized | 401 | authentication_error | no Authorization header, or the key lacks mcp:tools |
mcp_tool_not_found | 404 | not_found_error | wrong tool name → call ulex_list_tools and match exactly |
#JSON-RPC error mapping over MCP
MCP wraps tool errors in a successful JSON-RPC response, because a tool failure is not a protocol failure:
{
"jsonrpc": "2.0",
"id": 7,
"result": {
"content": [
{
"type": "text",
"text": "{\"error\":{\"type\":\"permission_error\",\"code\":\"insufficient_scope\",\"message\":\"This credential requires the write:organizations scope.\",\"request_id\":\"req_01M3PSW9R0175NAW62NYR403R8\",\"retryable\":false,\"hint\":\"Request scope: write:organizations.\"}}"
}
],
"isError": true
}
}Protocol-level problems — malformed JSON-RPC, unknown method, bad jsonrpc version — use the standard JSON-RPC error object instead:
{
"jsonrpc": "2.0",
"id": 7,
"error": { "code": -32601, "message": "Method not found", "data": { "method": "tools/calll" } }
}isError: true means read the ulex envelope out of content[0].text. JSON-RPC error codes: -32700 parse error, -32600 invalid request, -32601 method not found, -32602 invalid params, -32603 internal error.
#SCIM error body
SCIM endpoints return a different envelope, because RFC 7644 §3.12 mandates it:
{
"schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"],
"status": "409",
"scimType": "uniqueness",
"detail": "A User with userName pat@acme.example already exists.",
"request_id": "req_01M3PSW9R0175NAW62NYR403R8"
}scimType | HTTP | Meaning |
|---|---|---|
invalidFilter | 400 | bad filter syntax |
tooMany | 400 | filter returned more than one match; add an equality condition |
uniqueness | 409 | userName or externalId collision |
mutability | 400 | you tried to change an immutable attribute (id, schemas) |
invalidSyntax | 400 | body is not valid SCIM JSON |
invalidPath | 400 | path in a PATCH does not exist |
noTarget | 400 | PATCH operation targeted a missing attribute |
Map scimType back to the ulex envelope if your agent only speaks one error grammar:
const TYPE_BY_SCIM: Record<string, UlexErrorType> = {
invalidFilter: "invalid_request_error",
tooMany: "invalid_request_error",
invalidSyntax: "invalid_request_error",
invalidPath: "invalid_request_error",
mutability: "conflict_error",
uniqueness: "conflict_error",
};#Webhook delivery failures
Failures do not reach you as a response. They are recorded as a webhook_delivery and visible at GET /webhooks/{id}/deliveries:
{
"id": "dlv_01M3PSVM8G1BF1SQ3FQ0FPKJJA",
"object": "webhook_delivery",
"webhook_id": "whk_01M3PSVK981SXWGKG9JXHC1P0Y",
"event": "user.created",
"event_id": "evt_01M3PSW3WGDDFJFJHZ4QJNNFZD",
"status": "delivered",
"attempt": 1,
"max_attempts": 8,
"response_status": 200,
"response_body": "{\"received\":true}",
"error": null,
"duration_ms": 84,
"next_attempt_at": null,
"delivered_at": "2026-09-29T14:42:18.000Z"
}#Decoding a code
If you have a code and no context:
{ "name": "ulex_explain_error", "arguments": { "code": "saml_signature_invalid" } }{
"code": "saml_signature_invalid",
"type": "invalid_request_error",
"http_status": 400,
"retryable": false,
"message": "The SAML assertion signature did not verify against the connection's configured certificate.",
"causes": [
"The IdP is signing with a different certificate than the one on the connection.",
"The certificate was rotated upstream and ulex still has the old one.",
"The assertion is signed with a weak algorithm the connection does not allow."
],
"fixes": [
"Download the current signing certificate from the IdP and PATCH /connections/{id} with config.saml.x509_certificate.",
"Call POST /connections/{id}/verify to re-validate before retrying the login.",
"Confirm config.saml.signature_validation is 'strict' and signature_algorithm matches the IdP."
],
"docs_url": "https://docs.ulexid.com/troubleshooting/saml-issues"
}Deeper: Common errors, Status codes.