Better Enrollment

Error codes

Every APIError code the plugin can return.

Errors are Better Auth APIErrors carrying a code and a message:

import { INVITE_ERROR_CODES } from "@octopi-ai/better-enrollment";

Invite state

CodeWhen
INVITE_NOT_FOUNDUnknown or no longer valid token
INVITE_EXPIREDThe invite passed its expiresAt
INVITE_REVOKEDThe invite was revoked
INVITE_ALREADY_USEDA single-use invite was already redeemed, or a public invite hit its use cap
EMAIL_ALREADY_INVITEDA pending invite of the same kind (and, for org-join, the same org) already holds that address; resend it
USER_ALREADY_EXISTSapp invite to an address that already has an established account

Roles and permissions

CodeWhen
INVALID_ROLERole rejected at create
ROLE_NO_LONGER_VALIDThe invited role no longer exists at redeem
ROLE_NOT_ALLOWED_FOR_ORG_JOINorg-join invites cannot set an app role
NOT_ALLOWED_TO_MANAGE_INVITESFailed the admin gate

Redemption guards

CodeWhen
PASSWORD_NOT_AVAILABLEA password was sent to a passwordless app
EMAIL_MISMATCHOpen-mode activation guard: the emails do not match
EMAIL_NOT_VERIFIEDOpen-mode activation guard: the email is not verified
USER_BANNEDBanned accounts cannot redeem
NAME_REQUIREDSign-up redemption without a name
ADDITIONAL_FIELD_REQUIREDA required additional field is missing
ADDITIONAL_FIELD_INVALIDAn additional field failed its type check or validator

Organizations

CodeWhen
SEAT_LIMIT_REACHEDNo seats left, at create or at redeem
ORG_INVITE_NOT_ALLOWEDNot permitted to invite into that organization
ORG_DISABLEDThe organization is disabled
ORG_SLUG_TAKENSlug collision while founding an organization

Last updated on

On this page