Errors.ts overview


Exports Grouped by Category


errors

SignUpAttributesConfigError (class)

Http.make (or Http.makeAsync) was given strict: true and a signUpAttributes list naming a key of SIGN_UP_PROTECTED_ATTRIBUTES (the ban, SCIM and anonymous-user keys). A sign-up never stores those whatever the list says, so naming one does nothing; without strict the handler logs a warning instead. attributes lists the protected keys named.

Exported from the package root and from the ./http subpath as SignUpAttributesConfigError. Both names are the same class.

Signature

declare class SignUpAttributesConfigError

Source

Since v0.9.0

utils

AccountLockedError (class)

Account is temporarily locked due to too many failed sign-in attempts. Raised by the AccountLockoutPlugin. retryAfter, when present, is how long the lock has left to run; an HTTP layer that sends it as a Retry-After header rounds it up to whole seconds.

Signature

declare class AccountLockedError

Source

AuthError (class)

Generic infrastructure/unexpected error. Use only for failures that are NOT user-input or flow outcomes (e.g. store unavailability, crypto failure). For flow outcomes use a specific tagged error.

Signature

declare class AuthError

Source

CaptchaError (class)

Bot/captcha verification failed. Raised by the CaptchaPlugin.

Signature

declare class CaptchaError

Source

ChallengeExpiredError (class)

WebAuthn challenge exists but has expired.

Signature

declare class ChallengeExpiredError

Source

ChallengeNotFoundError (class)

No pending WebAuthn challenge found for the session.

Signature

declare class ChallengeNotFoundError

Source

ClientAddressConfigError (class)

A client-address-keyed rate limit is configured with no client-address source: no trustedProxy. A Web Request never carries a socket address, so without a configured source the limiter could not key the request. It would have to skip the request, share one bucket between callers or refuse every request, and none of these is allowed.

Raised at build time, before any request:

  • Http.make throws it synchronously when ipRateLimit (on unless it is false) has no trustedProxy, when the Hooks in services include IPRateLimitPlugin with no trustedProxy, and when the services include an OidcProviderService with dynamic client registration enabled and there is no trustedProxy. With no proxy no request has an address, so every limited request would be refused with 429, and the handler refuses to start instead.

Http.makeAsync rejects with the same errors Http.make throws, so the app fails to start either way.

Exported from the package root and from the ./http subpath as ClientAddressConfigError. Both names are the same class.

Signature

declare class ClientAddressConfigError

Source

ConfusableEmailError (class)

An email address that mixes scripts or passes for an ASCII address, which ConfusablesPlugin refuses as a new address. reason says which check refused it; the address is left out, so the error can be logged.

Signature

declare class ConfusableEmailError

Source

Since v0.9.0

CredentialNotFoundError (class)

WebAuthn credential not found.

Signature

declare class CredentialNotFoundError

Source

EmailInUseError (class)

The email address is already associated with another account (sign-up or change-email targeting a taken address).

Signature

declare class EmailInUseError

Source

EmailNotVerifiedError (class)

User has not yet verified their email address.

Signature

declare class EmailNotVerifiedError

Source

EmailVerificationError (class)

Email verification operation failed (e.g. token invalid, already used).

Signature

declare class EmailVerificationError

Source

ErrorCode

The stable code every domain error carries. Append-only: a code is never renamed or removed, so clients and the Messages catalogue can rely on it.

Signature

declare const ErrorCode: {
  readonly AUTH_ERROR: "AUTH_ERROR"
  readonly HASHING_ERROR: "HASHING_ERROR"
  readonly INVALID_CREDENTIALS: "INVALID_CREDENTIALS"
  readonly SESSION_NOT_FOUND: "SESSION_NOT_FOUND"
  readonly SESSION_EXPIRED: "SESSION_EXPIRED"
  readonly USER_NOT_FOUND: "USER_NOT_FOUND"
  readonly EMAIL_NOT_VERIFIED: "EMAIL_NOT_VERIFIED"
  readonly EMAIL_IN_USE: "EMAIL_IN_USE"
  readonly EMAIL_VERIFICATION_ERROR: "EMAIL_VERIFICATION_ERROR"
  readonly PASSWORD_TOO_SHORT: "PASSWORD_TOO_SHORT"
  readonly PASSWORD_TOO_LONG: "PASSWORD_TOO_LONG"
  readonly PASSWORD_ALREADY_SET: "PASSWORD_ALREADY_SET"
  readonly PWNED_PASSWORD: "PWNED_PASSWORD"
  readonly SIGN_UP_DISABLED: "SIGN_UP_DISABLED"
  readonly INVALID_INPUT: "INVALID_INPUT"
  readonly CAPTCHA_FAILED: "CAPTCHA_FAILED"
  readonly CONFUSABLE_EMAIL: "CONFUSABLE_EMAIL"
  readonly ACCOUNT_LOCKED: "ACCOUNT_LOCKED"
  readonly USER_BANNED: "USER_BANNED"
  readonly REAUTHENTICATION_REQUIRED: "REAUTHENTICATION_REQUIRED"
  readonly NOT_AUTHENTICATED: "NOT_AUTHENTICATED"
  readonly PERMISSION_DENIED: "PERMISSION_DENIED"
  readonly INSUFFICIENT_SCOPE: "INSUFFICIENT_SCOPE"
  readonly CHALLENGE_NOT_FOUND: "CHALLENGE_NOT_FOUND"
  readonly CHALLENGE_EXPIRED: "CHALLENGE_EXPIRED"
  readonly CREDENTIAL_NOT_FOUND: "CREDENTIAL_NOT_FOUND"
  readonly WEBAUTHN_VERIFICATION_ERROR: "WEBAUTHN_VERIFICATION_ERROR"
  readonly OAUTH_STATE_NOT_FOUND: "OAUTH_STATE_NOT_FOUND"
  readonly OAUTH_STATE_EXPIRED: "OAUTH_STATE_EXPIRED"
  readonly OAUTH_PROVIDER_ERROR: "OAUTH_PROVIDER_ERROR"
  readonly OAUTH_ACCOUNT_NOT_LINKED: "OAUTH_ACCOUNT_NOT_LINKED"
  readonly OAUTH_MISSING_EMAIL: "OAUTH_MISSING_EMAIL"
  readonly OAUTH_ACCOUNT_CONFLICT: "OAUTH_ACCOUNT_CONFLICT"
  readonly OAUTH_ACCOUNT_NOT_FOUND: "OAUTH_ACCOUNT_NOT_FOUND"
  readonly OAUTH_NO_REFRESH_TOKEN: "OAUTH_NO_REFRESH_TOKEN"
  readonly OAUTH_LAST_CREDENTIAL: "OAUTH_LAST_CREDENTIAL"
  readonly OAUTH_EMAIL_MISMATCH: "OAUTH_EMAIL_MISMATCH"
  readonly RATE_LIMIT_EXCEEDED: "RATE_LIMIT_EXCEEDED"
  readonly RESEND_TOO_SOON: "RESEND_TOO_SOON"
  readonly LAST_ORGANIZATION_OWNER: "LAST_ORGANIZATION_OWNER"
  readonly MAGIC_LINK_ERROR: "MAGIC_LINK_ERROR"
  readonly PASSWORD_RESET_ERROR: "PASSWORD_RESET_ERROR"
  readonly ONE_TIME_TOKEN_ERROR: "ONE_TIME_TOKEN_ERROR"
  readonly IMPERSONATION_FORBIDDEN: "IMPERSONATION_FORBIDDEN"
}

Source

ErrorCode (type alias)

Signature

type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode]

Source

HashingError (class)

Password hashing/verification failed (infrastructure).

Signature

declare class HashingError

Source

ImpersonationForbiddenError (class)

The operation changes the account’s credentials or identity, and the session asking is an administrator’s impersonation, which may not. Raised by Impersonation.assertNotImpersonating and the services it guards.

Signature

declare class ImpersonationForbiddenError

Source

InsufficientScopeError (class)

OAuth-style scope check: caller has been granted fewer scopes than required.

Signature

declare class InsufficientScopeError

Source

InvalidCredentialsError (class)

Submitted credentials are invalid. Always uses the generic “Invalid email or password” message to prevent user enumeration.

Signature

declare class InvalidCredentialsError

Source

InvalidInputError (class)

A required input field is missing or empty (e.g. blank email after normalization). field names the offending field for the HTTP response.

Signature

declare class InvalidInputError

Source

LastOrganizationOwnerError (class)

Deleting a user who is the last active owner of an organization that still has other members. Transfer ownership, or remove the other members, first; nothing of the user was deleted.

Signature

declare class LastOrganizationOwnerError

Source

MagicLinkError (class)

Magic link send/verify failure (infrastructure or token mismatch).

Signature

declare class MagicLinkError

Source

NotAuthenticatedError (class)

No principal is present: the effect required an authenticated user and the current execution is anonymous.

The authentication counterpart to PermissionDeniedError: that one means “we know who you are and you may not”; this one means “we do not know who you are”. Raised by the failing accessors in SessionContext (requireCurrentUser, requireCurrentSession) so a guard can turn an anonymous context into a typed failure without reaching for the HTTP layer’s Unauthorized.

Signature

declare class NotAuthenticatedError

Source

OAuthAccountConflictError (class)

The OAuth account is already linked to a different user.

Signature

declare class OAuthAccountConflictError

Source

OAuthAccountNotFoundError (class)

No OAuth account for the given provider is linked to the user.

Signature

declare class OAuthAccountNotFoundError

Source

OAuthAccountNotLinkedError (class)

OAuth account exists in the store but is not linked to any user. Use linkAccount to associate it with a user before signing in.

Signature

declare class OAuthAccountNotLinkedError

Source

OAuthEmailMismatchError (class)

The OAuth account’s provider email differs from the user’s current account email. Pass allowDifferentEmails: true in OAuthServiceOptions to override.

Signature

declare class OAuthEmailMismatchError

Source

OAuthLastCredentialError (class)

Unlinking would remove the user’s last sign-in credential: no other linked OAuth account remains and the user has no password. Pass allowUnlinkingAll: true to unlinkAccount to override.

Signature

declare class OAuthLastCredentialError

Source

OAuthMissingEmailError (class)

The OAuth provider did not return an email address for this account.

Signature

declare class OAuthMissingEmailError

Source

OAuthNoRefreshTokenError (class)

The OAuth account has no stored refresh token.

Signature

declare class OAuthNoRefreshTokenError

Source

OAuthProviderError (class)

External OAuth provider returned an error or unexpected response.

Signature

declare class OAuthProviderError

Source

OAuthStateExpiredError (class)

OAuth CSRF state token has expired.

Signature

declare class OAuthStateExpiredError

Source

OAuthStateNotFoundError (class)

OAuth CSRF state token not found (unknown or already consumed).

Signature

declare class OAuthStateNotFoundError

Source

OneTimeTokenError (class)

One-time token verification failure (invalid, expired, or already used).

Anti-enumeration: all failure cases surface the same generic message so callers cannot distinguish between a token that never existed and one that has already been consumed.

Signature

declare class OneTimeTokenError

Source

PasswordAlreadySetError (class)

Attempting to set a password for a user that already has one. Callers should use changePassword instead.

Signature

declare class PasswordAlreadySetError

Source

PasswordPolicyError (class)

Password does not meet length policy requirements.

code is "PASSWORD_TOO_SHORT" or "PASSWORD_TOO_LONG". params carries the policy bounds for message interpolation.

Signature

declare class PasswordPolicyError

Source

PasswordResetError (class)

Password reset send/verify failure (infrastructure or token mismatch).

Signature

declare class PasswordResetError

Source

PermissionDeniedError (class)

Caller lacks the required permission.

Signature

declare class PermissionDeniedError

Source

PwnedPasswordError (class)

The supplied password appears in a known data-breach corpus (HIBP).

Signature

declare class PwnedPasswordError

Source

RateLimitError (class)

Rate limit exceeded. retryAfter, when present, is how long the caller must wait before retrying; an HTTP layer that sends it as a Retry-After header rounds it up to whole seconds.

Signature

declare class RateLimitError

Source

RateLimiterConfigError (class)

A rate limit is configured with no RateLimiter in services, so it could not run. The limits are Http.make’s ipRateLimit (on unless it is false), the dynamic client registration limit (POST /register) and the device user-code limit on lookups and decisions, which counts as configured whenever a DeviceAuthorizationService is in services unless it was built with allowMissingRateLimiter: true.

Http.make throws it synchronously when services builds synchronously, so the app fails to start. When services does asynchronous work while building (a database connection, for example), make returns before the build can be checked: the handler’s build fails with this error instead, and every request rejects with it. Http.makeAsync rejects with it at startup, so the app fails to start, however services is composed.

It is also the error for an ipv6PrefixLength that is not an integer from 1 to 128: Http.make throws it for ipRateLimit.ipv6PrefixLength, and the IPRateLimitPlugin layer build dies with it.

Signature

declare class RateLimiterConfigError

Source

ReauthenticationRequiredError (class)

A sensitive change (starting an email change) needs fresh proof that the caller is the account holder: the current password, or for an account without one, a recent sign-in.

Signature

declare class ReauthenticationRequiredError

Source

ResendTooSoonError (class)

Resend requested before the per-identifier cooldown window has elapsed. retryAfter is how long the caller must wait before sending again; an HTTP layer that sends it as a Retry-After header rounds it up to whole seconds. Raised by the passwordless send paths when resendCooldown is configured in the flow config.

Signature

declare class ResendTooSoonError

Source

ServicesBuildPendingError (class)

Http.make was called with strict: true, and the services build had not finished when make had run it as far as it runs synchronously. The build waits on asynchronous work (a database connection, Effect.promise), on a merged layer that yields, on a forked fiber that yields before it completes a Deferred the build awaits, or, when the build fails, on a finalizer that does asynchronous work. The message names Http.makeAsync, which waits for such a build.

make throws it synchronously, so the app fails to start. Before it throws, make interrupts the build and releases what the build acquired, as far as that runs synchronously. Two parts finish after make has thrown: a finalizer that does asynchronous work, and, when the build is in an uninterruptible step that waits on asynchronous work (an Effect.acquireRelease acquire that awaits), the whole release, since the interrupt waits for that step to end.

It cannot carry a failure the build ends with only after make throws: when the build is failing (a step that failed while a finalizer it runs awaits), make logs that failure with Effect.logError when the build ends.

Without strict, make never raises it: it returns, and the startup checks run when the build finishes.

Exported from the package root and from the ./http subpath as ServicesBuildPendingError. Both names are the same class.

Signature

declare class ServicesBuildPendingError

Source

SessionConfigError (class)

SessionService.layer (or SessionService.make) was given a sessionExpiresIn that cannot work: an activePeriod or idlePeriod that is not a finite, positive number of milliseconds (NaN from an unset Number(env), for example), or an updateAge that is not a finite number, 0 or more. The layer build dies with it, so the app fails to start instead of issuing sessions that never expire.

Signature

declare class SessionConfigError

Source

SessionExpiredError (class)

Session exists but has expired (absolute lifetime or idle timeout).

Signature

declare class SessionExpiredError

Source

SessionNotFoundError (class)

Session ID not found in the store.

Signature

declare class SessionNotFoundError

Source

SignUpDisabledError (class)

Email/password sign-up has been administratively disabled via config.

Signature

declare class SignUpDisabledError

Source

UserBannedError (class)

The user is banned or SCIM-deactivated. SessionService raises it when it would create or answer a session for such a user.

Signature

declare class UserBannedError

Source

UserNotFoundError (class)

User record not found in the store.

Signature

declare class UserNotFoundError

Source

WebAuthnVerificationError (class)

WebAuthn verification step failed (signature, origin, RP ID, …).

Signature

declare class WebAuthnVerificationError

Source


This site uses Just the Docs, a documentation theme for Jekyll.