Skip to main content

Errors

The envelope​

Every error uses one shared shape, returned on any operation:

{
"error": {
"code": "invalid_credentials",
"message": "The email or password is incorrect.",
"request_id": "req_...",
"details": { }
}
}

Branch on error.code — a stable machine string. Never parse the message (localized) or key logic off the HTTP status.

Errors inside a flow

Within a resumable flow, transient input errors surface as FlowState.error {code, message} while status stays pending — do not map those to an HTTP status.

Code ↔ status table​

HTTPCodes
400bad_request, unsupported_grant
401invalid_credentials, unauthorized, invalid_token, token_expired, token_revoked, session_expired, device_mismatch, mfa_invalid, invalid_otp, challenge_invalid
403forbidden, account_suspended, account_banned, account_locked, email_not_verified, phone_not_verified, mfa_required, mfa_factor_not_allowed, step_up_required, registration_closed, invitation_required, captcha_required, captcha_invalid, consent_required, invalid_csrf
404not_found, user_not_found, session_not_found, project_not_found, environment_not_found, client_not_found, connection_not_found, domain_not_found
409conflict, email_exists, phone_exists, identity_exists, already_linked, domain_taken
410challenge_expired, token_already_used, flow_not_found, flow_expired
422validation_failed, weak_password, password_reused
429rate_limited, flow_resend_too_soon
501not_implemented
502provider_error, sso_error, scim_error
503service_unavailable
500internal_error

Handling pattern​

const { data, error } = await iam.auth.signInWithPassword({ email, password });
if (error) {
switch (error.code) {
case 'invalid_credentials': return showError('Wrong email or password');
case 'account_locked': return showError('Too many attempts, try later');
case 'email_not_verified': return startEmailVerification();
default: return showError(error.message);
}
}