Errors
Every sentinel error, its HTTP wire code, and what a caller should do.
Programmatic calls return sentinel errors from the root package. Check them with errors.Is.
HTTP calls return {"error": code, "message": msg}; the code values are published in the
ApiError enum of the OpenAPI contract and the TypeScript client's SignetApiError.
if errors.Is(err, signet.ErrInvalidCredentials) {
// show a generic sign-in failure
}Configuration errors
| Sentinel | HTTP / wire code | Meaning and action |
|---|---|---|
| ErrMissingStore | 500 internal_error | No Store supplied. Set cfg.Store. |
| ErrMissingMailer | 500 internal_error | No Mailer supplied. Set cfg.Mailer. |
| ErrMissingHasher | — (not emitted by New) | Exported for compatibility; New defaults the hasher and never returns this. |
| ErrMissingRateLimiter | 500 internal_error | No RateLimiter supplied. Set cfg.RateLimiter. |
| ErrInsecureConfig | 500 internal_error | Cookies are not secure. Use DefaultConfig() or the explicit Insecure* opt-in. |
| ErrInvalidCSRFConfig | 500 internal_error | CSRFKey is not 32 bytes and JWTOnly is false. |
| ErrInvalidPasskeysConfig | 500 internal_error | Passkeys is configured with a missing or invalid Relying party ID or origins. |
| ErrInvalidAuthorizationServerConfig | 500 internal_error | AuthorizationServer is configured without a JWT config. |
| ErrOAuthSlowDown | 400 slow_down | A device polled the token endpoint too quickly; back off before retrying. |
| ErrSSOConnectionNotFound | 404 sso_connection_not_found | No SSO connection matches the Organization or email domain. |
| ErrSSODomainNotVerified | 403 sso_domain_not_verified | The domain has not been verified for this Organization. |
| ErrSSOInvalidAssertion | 401 sso_invalid_assertion | The OIDC assertion or state Token was rejected. |
| ErrInvalidSSOConfig | 500 internal_error | SSO is configured without a connection store. |
| ErrSAMLInvalidAssertion | 401 saml_invalid_assertion | The SAML assertion failed signature, issuer, audience, time or binding validation. |
| ErrSAMLConnectionNotFound | 404 saml_connection_not_found | No SAML connection matches the request. |
| ErrSAMLReplay | 401 saml_replay | The assertion ID was already used. |
| ErrInvalidSCIMConfig | 500 internal_error | SCIM is configured without a store or bearer token. |
| ErrSCIMUnauthorized | 401 unauthorized | The SCIM bearer token was missing or invalid. |
forbidden from automatic sign-in | 403 forbidden | Sign-up did not issue a Session because the email is unverified and verification is required. |
| ErrInvalidOAuthConfig | 500 internal_error | OAuth providers, redirects or StateKey are invalid. |
| ErrInvalidPasswordlessConfig | 500 internal_error | Passwordless.MagicLinkTTL or Passwordless.OTPTTL is negative. |
| ErrInvalidJWTAlgorithm | 500 internal_error | Algorithm is outside the allowlist, or a token used a different one. |
| ErrInvalidJWTKey | 500 internal_error | Key type does not match the algorithm. |
| ErrInvalidKeyRing | 500 internal_error | A key ring is empty, mixed or contains duplicate keys. |
| ErrInvalidRedirectPattern | 500 internal_error | A redirect pattern is not https, lacks two host labels, or misplaces the wildcard. |
| ErrInvalidUsername | 400 invalid_input | A Username is malformed, too short, too long or reserved. |
| ErrUsernameTaken | 400 username_taken | Another User already owns the Username. |
| ErrLastAccount | 400 last_account | Unlinking would leave the User without any Account. |
| ErrTOTPNotEnabled | 400 two_factor_not_enabled | The User has no active Second factor enrollment. |
| ErrTOTPInvalid | 401 invalid_code | A TOTP code or Backup code was invalid or already used. |
| ErrTwoFactorRequired | 401 two_factor_required | Sign-in needs a Second factor challenge. |
| ErrTOTPNotConfigured | 404 not_found | A TOTP operation was called without both a TOTPStore and a 32-byte TOTPKey. |
| ErrPasswordCompromised | 400 password_compromised | The password was found in a known breach. |
| ErrCaptchaRequired | 400 invalid_input | A configured endpoint was called without X-Captcha-Response. |
| ErrCaptchaInvalid | 400 invalid_input | Captcha verification was rejected. |
| ErrCaptchaUnavailable | 503 captcha_unavailable | The captcha provider could not be reached. |
| ErrInvalidCaptchaEndpoint | 500 internal_error | A configured captcha endpoint name is not supported. |
Credentials and email
| Sentinel | HTTP / wire code | Meaning and action |
|---|---|---|
| ErrInvalidCredentials | 401 invalid_credentials | Wrong password, disabled User or missing credential Account. Fail generically. |
| ErrEmailNotVerified | 403 email_not_verified | Sign-in blocked. Verify the email or disable verification. |
| ErrInvalidEmail | 400 invalid_input | Empty or malformed email. |
| ErrUserNotFound | 404 user_not_found | No User exists for the email supplied to add an Organization Membership. |
| ErrInvalidMemberInput | 400 invalid_input | A Membership add sent both user_id and email, or neither. |
| ErrEmailAlreadyExists | 400 email_exists | Sign-up with a registered email. |
| ErrPasswordTooShort | 400 invalid_input | Below Password.MinLength. |
| ErrPasswordTooLong | 400 invalid_input | Above Password.MaxLength. |
Tokens and sessions
A missing or invalid session returns 401 unauthorized with "authentication required" —
sign in first and send the session cookie and CSRF token.
| Sentinel | HTTP / wire code | Meaning and action |
|---|---|---|
| ErrNotFound | no dedicated mapping — surfaces as 500 internal_error | Entity or Session not found. 404 not_found comes from JWT/OAuth-disabled sentinels and unknown routes. |
| ErrInvalidRateLimitRule | 500 internal_error | A rule names an endpoint that is not published. |
| ErrSessionNotFresh | 403 session_not_fresh | Session resolved but older than the configured freshness window (Accounts.FreshWindow, 5 minutes by default). The permission would have been granted; sign in again and retry. |
| ErrTokenInvalid | 401 invalid_token | Malformed, unknown or replayed Token, including a magic link. |
| ErrTokenConsumed | 401 invalid_token | A Token was already used. Wraps ErrTokenInvalid, so existing errors.Is checks keep working. |
| ErrInvalidOTP | 401 invalid_code | Missing, malformed, unknown, wrong-email or expired email OTP. |
| ErrOTPAlreadyUsed | 401 code_already_used | The email OTP was consumed; request a new code. |
| ErrInvalidMagicLink | 401 invalid_link | Missing, malformed, unknown or expired magic link. |
| ErrMagicLinkAlreadyUsed | 401 link_already_used | The magic link was consumed; request a new one. |
| ErrTokenExpired | 401 invalid_token | Token past its expiry; request a fresh one. |
| ErrRefreshReuse | 401 invalid_token | Refresh replay. All Sessions and Tokens for that User were revoked; sign in again. |
JWT and OAuth
| Sentinel | HTTP / wire code | Meaning and action |
|---|---|---|
| ErrJWTDisabled | 404 not_found | JWT method called without Config.JWT. |
| ErrOAuthDisabled | 404 not_found | OAuth method called without Config.OAuth. |
| ErrOAuthProviderNotFound | 404 not_found | Provider name is not registered. |
| ErrOAuthRedirectNotAllowed | 400 invalid_request | Redirect is outside the exact allowlist and configured patterns. |
| ErrOAuthInvalidState | 400 invalid_request | Tampered, expired or mismatched OAuth state. |
| ErrOAuthEmailNotVerified | 403 oauth_email_not_verified | Provider did not return a verified email. |
| ErrOAuthAccountConflict | 409 oauth_account_conflict | Provider Account already belongs to another User. |
Protection and abuse
| Sentinel | HTTP / wire code | Meaning and action |
|---|---|---|
| ErrRateLimited | 429 rate_limited | Too many attempts, including failed OTP guesses; retry later. |
| ErrInvalidCSRFConfig | 500 internal_error | See configuration errors above. |
| ErrForbidden | 403 forbidden | The actor lacks the required permission, is acting on another owner's keys, or attempted a self-action ban/impersonation. Guarded denials emit an Audit event. A stale but otherwise sufficient Session returns 403 session_not_fresh instead. |
| ErrMissingOrgID | 400 invalid_input | An organization endpoint was called without organization_id. |
CSRF wire errors
The CSRF guard has no exported sentinel: a rejected browser request returns HTTP 403 with
wire code csrf. Headerless clients can avoid it by not presenting a session cookie; use
JWT mode for non-browser clients. See Security.