Stack Auth uses known errors for expected, actionable failures. Some public SDK methods returnDocumentation Index
Fetch the complete documentation index at: https://docs.hexclave.com/llms.txt
Use this file to discover all available pages before exploring further.
Result<..., KnownErrors["..."]> in their TypeScript signatures. This page lists only the known errors currently exposed through those public TypeScript types.
Stack Auth has additional internal known errors for API implementation details.
They are intentionally not part of this public SDK reference.
errorCode value. In the REST API, the same value appears as the JSON code field and the X-Stack-Known-Error response header.
Handling known errors
When using SDK methods that returnResult, check result.status and inspect result.error.
error.errorCode:
code field from the JSON response body.
Error messages are human-readable and may include request-specific details.
Use
code for programmatic handling.Exposed known errors
| Public TypeScript type | Runtime errorCode | Returned by |
|---|---|---|
KnownErrors["EmailPasswordMismatch"] | EMAIL_PASSWORD_MISMATCH | stackClientApp.signInWithCredential() |
KnownErrors["InvalidTotpCode"] | INVALID_TOTP_CODE | stackClientApp.signInWithCredential(), stackClientApp.signInWithMagicLink(), stackClientApp.signInWithMfa(), stackClientApp.signInWithPasskey() |
KnownErrors["UserWithEmailAlreadyExists"] | USER_EMAIL_ALREADY_EXISTS | stackClientApp.signUpWithCredential() |
KnownErrors["PasswordRequirementsNotMet"] | PASSWORD_REQUIREMENTS_NOT_MET | stackClientApp.signUpWithCredential(), user.updatePassword(), user.setPassword() |
KnownErrors["BotChallengeFailed"] | BOT_CHALLENGE_FAILED | stackClientApp.signUpWithCredential(), stackClientApp.sendMagicLinkEmail() |
KnownErrors["PasskeyAuthenticationFailed"] | PASSKEY_AUTHENTICATION_FAILED | stackClientApp.signInWithPasskey() |
KnownErrors["PasskeyRegistrationFailed"] | PASSKEY_REGISTRATION_FAILED | user.registerPasskey() |
KnownErrors["PasskeyWebAuthnError"] | PASSKEY_WEBAUTHN_ERROR | stackClientApp.signInWithPasskey(), user.registerPasskey() |
KnownErrors["CliAuthError"] | CLI_AUTH_ERROR | stackClientApp.promptCliLogin() |
KnownErrors["CliAuthExpiredError"] | CLI_AUTH_EXPIRED_ERROR | stackClientApp.promptCliLogin() |
KnownErrors["CliAuthUsedError"] | CLI_AUTH_USED_ERROR | stackClientApp.promptCliLogin() |
KnownErrors["UserNotFound"] | USER_NOT_FOUND | stackClientApp.sendForgotPasswordEmail() |
KnownErrors["RedirectUrlNotWhitelisted"] | REDIRECT_URL_NOT_WHITELISTED | stackClientApp.sendMagicLinkEmail() |
KnownErrors["VerificationCodeError"] | VERIFICATION_ERROR | stackClientApp.resetPassword(), stackClientApp.verifyPasswordResetCode(), stackClientApp.verifyTeamInvitationCode(), stackClientApp.acceptTeamInvitation(), stackClientApp.getTeamInvitationDetails(), stackClientApp.verifyEmail(), stackClientApp.signInWithMagicLink(), stackClientApp.signInWithMfa() |
KnownErrors["OAuthAccessTokenNotAvailable"] | OAUTH_ACCESS_TOKEN_NOT_AVAILABLE | connectedAccount.getAccessToken(), connectedAccount.useAccessToken() |
KnownErrors["OAuthProviderAccountIdAlreadyUsedForSignIn"] | OAUTH_PROVIDER_ACCOUNT_ID_ALREADY_USED_FOR_SIGN_IN | oauthProvider.update(), serverOAuthProvider.update(), stackServerApp.createOAuthProvider() |
KnownErrors["EmailAlreadyVerified"] | EMAIL_ALREADY_VERIFIED | user.sendVerificationEmail() |
KnownErrors["PasswordConfirmationMismatch"] | PASSWORD_CONFIRMATION_MISMATCH | user.updatePassword() |
Parent error types
Some exposed types are parent classes for more specific errors. For example:KnownErrors["PasswordRequirementsNotMet"]may currently havePASSWORD_TOO_SHORTorPASSWORD_TOO_LONGas the runtimeerrorCode.KnownErrors["VerificationCodeError"]may currently haveVERIFICATION_CODE_NOT_FOUND,VERIFICATION_CODE_EXPIRED,VERIFICATION_CODE_ALREADY_USED, orVERIFICATION_CODE_MAX_ATTEMPTS_REACHEDas the runtimeerrorCode.
error.errorCode against the specific runtime code.