Skip to Content
Signet

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

SentinelHTTP / wire codeMeaning and action
ErrMissingStore500 internal_errorNo Store supplied. Set cfg.Store.
ErrMissingMailer500 internal_errorNo Mailer supplied. Set cfg.Mailer.
ErrMissingHasher— (not emitted by New)Exported for compatibility; New defaults the hasher and never returns this.
ErrMissingRateLimiter500 internal_errorNo RateLimiter supplied. Set cfg.RateLimiter.
ErrInsecureConfig500 internal_errorCookies are not secure. Use DefaultConfig() or the explicit Insecure* opt-in.
ErrInvalidCSRFConfig500 internal_errorCSRFKey is not 32 bytes and JWTOnly is false.
ErrInvalidPasskeysConfig500 internal_errorPasskeys is configured with a missing or invalid Relying party ID or origins.
ErrInvalidAuthorizationServerConfig500 internal_errorAuthorizationServer is configured without a JWT config.
ErrOAuthSlowDown400 slow_downA device polled the token endpoint too quickly; back off before retrying.
ErrSSOConnectionNotFound404 sso_connection_not_foundNo SSO connection matches the Organization or email domain.
ErrSSODomainNotVerified403 sso_domain_not_verifiedThe domain has not been verified for this Organization.
ErrSSOInvalidAssertion401 sso_invalid_assertionThe OIDC assertion or state Token was rejected.
ErrInvalidSSOConfig500 internal_errorSSO is configured without a connection store.
ErrSAMLInvalidAssertion401 saml_invalid_assertionThe SAML assertion failed signature, issuer, audience, time or binding validation.
ErrSAMLConnectionNotFound404 saml_connection_not_foundNo SAML connection matches the request.
ErrSAMLReplay401 saml_replayThe assertion ID was already used.
ErrInvalidSCIMConfig500 internal_errorSCIM is configured without a store or bearer token.
ErrSCIMUnauthorized401 unauthorizedThe SCIM bearer token was missing or invalid.
forbidden from automatic sign-in403 forbiddenSign-up did not issue a Session because the email is unverified and verification is required.
ErrInvalidOAuthConfig500 internal_errorOAuth providers, redirects or StateKey are invalid.
ErrInvalidPasswordlessConfig500 internal_errorPasswordless.MagicLinkTTL or Passwordless.OTPTTL is negative.
ErrInvalidJWTAlgorithm500 internal_errorAlgorithm is outside the allowlist, or a token used a different one.
ErrInvalidJWTKey500 internal_errorKey type does not match the algorithm.
ErrInvalidKeyRing500 internal_errorA key ring is empty, mixed or contains duplicate keys.
ErrInvalidRedirectPattern500 internal_errorA redirect pattern is not https, lacks two host labels, or misplaces the wildcard.
ErrInvalidUsername400 invalid_inputA Username is malformed, too short, too long or reserved.
ErrUsernameTaken400 username_takenAnother User already owns the Username.
ErrLastAccount400 last_accountUnlinking would leave the User without any Account.
ErrTOTPNotEnabled400 two_factor_not_enabledThe User has no active Second factor enrollment.
ErrTOTPInvalid401 invalid_codeA TOTP code or Backup code was invalid or already used.
ErrTwoFactorRequired401 two_factor_requiredSign-in needs a Second factor challenge.
ErrTOTPNotConfigured404 not_foundA TOTP operation was called without both a TOTPStore and a 32-byte TOTPKey.
ErrPasswordCompromised400 password_compromisedThe password was found in a known breach.
ErrCaptchaRequired400 invalid_inputA configured endpoint was called without X-Captcha-Response.
ErrCaptchaInvalid400 invalid_inputCaptcha verification was rejected.
ErrCaptchaUnavailable503 captcha_unavailableThe captcha provider could not be reached.
ErrInvalidCaptchaEndpoint500 internal_errorA configured captcha endpoint name is not supported.

Credentials and email

SentinelHTTP / wire codeMeaning and action
ErrInvalidCredentials401 invalid_credentialsWrong password, disabled User or missing credential Account. Fail generically.
ErrEmailNotVerified403 email_not_verifiedSign-in blocked. Verify the email or disable verification.
ErrInvalidEmail400 invalid_inputEmpty or malformed email.
ErrUserNotFound404 user_not_foundNo User exists for the email supplied to add an Organization Membership.
ErrInvalidMemberInput400 invalid_inputA Membership add sent both user_id and email, or neither.
ErrEmailAlreadyExists400 email_existsSign-up with a registered email.
ErrPasswordTooShort400 invalid_inputBelow Password.MinLength.
ErrPasswordTooLong400 invalid_inputAbove 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.

SentinelHTTP / wire codeMeaning and action
ErrNotFoundno dedicated mapping — surfaces as 500 internal_errorEntity or Session not found. 404 not_found comes from JWT/OAuth-disabled sentinels and unknown routes.
ErrInvalidRateLimitRule500 internal_errorA rule names an endpoint that is not published.
ErrSessionNotFresh403 session_not_freshSession 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.
ErrTokenInvalid401 invalid_tokenMalformed, unknown or replayed Token, including a magic link.
ErrTokenConsumed401 invalid_tokenA Token was already used. Wraps ErrTokenInvalid, so existing errors.Is checks keep working.
ErrInvalidOTP401 invalid_codeMissing, malformed, unknown, wrong-email or expired email OTP.
ErrOTPAlreadyUsed401 code_already_usedThe email OTP was consumed; request a new code.
ErrInvalidMagicLink401 invalid_linkMissing, malformed, unknown or expired magic link.
ErrMagicLinkAlreadyUsed401 link_already_usedThe magic link was consumed; request a new one.
ErrTokenExpired401 invalid_tokenToken past its expiry; request a fresh one.
ErrRefreshReuse401 invalid_tokenRefresh replay. All Sessions and Tokens for that User were revoked; sign in again.

JWT and OAuth

SentinelHTTP / wire codeMeaning and action
ErrJWTDisabled404 not_foundJWT method called without Config.JWT.
ErrOAuthDisabled404 not_foundOAuth method called without Config.OAuth.
ErrOAuthProviderNotFound404 not_foundProvider name is not registered.
ErrOAuthRedirectNotAllowed400 invalid_requestRedirect is outside the exact allowlist and configured patterns.
ErrOAuthInvalidState400 invalid_requestTampered, expired or mismatched OAuth state.
ErrOAuthEmailNotVerified403 oauth_email_not_verifiedProvider did not return a verified email.
ErrOAuthAccountConflict409 oauth_account_conflictProvider Account already belongs to another User.

Protection and abuse

SentinelHTTP / wire codeMeaning and action
ErrRateLimited429 rate_limitedToo many attempts, including failed OTP guesses; retry later.
ErrInvalidCSRFConfig500 internal_errorSee configuration errors above.
ErrForbidden403 forbiddenThe 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.
ErrMissingOrgID400 invalid_inputAn 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.

On this page