# Auth diagnostics

<!-- Generated by docs/modules/diagnostics from the package catalogs. Write a guide in docs/diagnostics/<CODE>.md instead of editing this file. -->

Each Auth error has a stable `code`. Its `docs` link opens the page of that code. This page lists all 110 codes, and [All diagnostics](https://vitehub.dev/docs/reference/diagnostics) lists every primitive.

## Runtime errors

| Code | What happened |
| --- | --- |
| [`AUTH_GITHUB_NOT_ORG_MEMBER`](https://vitehub.dev/docs/auth/diagnostics/auth_github_not_org_member) | The GitHub user is not an active member of `<org>`, or the invitation is still pending. |
| [`AUTH_GITHUB_ORG_ACCESS_DENIED`](https://vitehub.dev/docs/auth/diagnostics/auth_github_org_access_denied) | The token cannot read the memberships of `<org>`. It needs the `read:org` scope, and the organization must allow the OAuth app. |
| [`AUTH_GITHUB_TOKEN_INVALID`](https://vitehub.dev/docs/auth/diagnostics/auth_github_token_invalid) | GitHub rejected the access token, or there is none. It expired or was revoked. |
| [`AUTH_GITHUB_UNAVAILABLE`](https://vitehub.dev/docs/auth/diagnostics/auth_github_unavailable) | GitHub answered the membership check with HTTP \<status\>. It is down or rate limited the token. |
| [`AUTH_MCP_CLEANUP_FAILED`](https://vitehub.dev/docs/auth/diagnostics/auth_mcp_cleanup_failed) | The Auth database could not list or delete OAuth clients. |
| [`AUTH_MCP_TOKEN_INVALID`](https://vitehub.dev/docs/auth/diagnostics/auth_mcp_token_invalid) | The access token is not valid: \<reason\> |
| [`AUTH_MCP_TOKEN_MISSING`](https://vitehub.dev/docs/auth/diagnostics/auth_mcp_token_missing) | The request has no `Authorization: Bearer` access token. |

## Runtime error

| Code | What happened |
| --- | --- |
| [`AUTH_NOT_MEMBER`](https://vitehub.dev/docs/auth/diagnostics/auth_not_member) | `VITEHUB_MEMBERS` does not list this account, its verified email, its email domain, or a GitHub organization that it is an active member of. |

## Config error

| Code | What happened |
| --- | --- |
| [`AUTH_GITHUB_ORG_REQUIRED`](https://vitehub.dev/docs/auth/diagnostics/auth_github_org_required) | `checkGitHubOrgMember()` got an empty organization login. |

## Configuration errors

| Code | What happened |
| --- | --- |
| [`AUTH_MCP_OAUTH_MISSING`](https://vitehub.dev/docs/auth/diagnostics/auth_mcp_oauth_missing) | The Auth has no MCP OAuth: its plugins do not include `oauthProvider()` with `resources`. |
| [`AUTH_MEMBERS_ENTRY_INVALID`](https://vitehub.dev/docs/auth/diagnostics/auth_members_entry_invalid) | `VITEHUB_MEMBERS` has the entry `<entry>`. \<reason\> |
| [`AUTH_MEMBERS_SESSION_STORE_REQUIRED`](https://vitehub.dev/docs/auth/diagnostics/auth_members_session_store_required) | `VITEHUB_MEMBERS` is set, but Auth has no Better Auth `database` or `secondaryStorage` adapter. Auth cannot end the session of a person who leaves the list when the session lives only in a cookie. |

## Published numbered errors

| Code | What happened |
| --- | --- |
| [`AUTH_B0001`](https://vitehub.dev/docs/auth/diagnostics/auth_b0001) | `@vite-hub/auth/nuxt` env.projectRoot must match the installed `@vite-hub/env/vite` plugin. |
| [`AUTH_B0002`](https://vitehub.dev/docs/auth/diagnostics/auth_b0002) | Route rule \<key\> sets `<name>` on \<method\> requests to paths that the `access.routes` entry \<route\> guards. A cached or prerendered response is made for one visitor and served to others. |
| [`AUTH_C0001`](https://vitehub.dev/docs/auth/diagnostics/auth_c0001) | `defineAuth()` \<label\> must be an inline string literal. |
| [`AUTH_C0002`](https://vitehub.dev/docs/auth/diagnostics/auth_c0002) | `defineAuth()` \<label\> must be a non-empty trimmed string. |
| [`AUTH_C0003`](https://vitehub.dev/docs/auth/diagnostics/auth_c0003) | `defineAuth()` \<label\> must start with `/`. |
| [`AUTH_C0005`](https://vitehub.dev/docs/auth/diagnostics/auth_c0005) | `defineAuth()` \<label\> must use static object keys. |
| [`AUTH_C0006`](https://vitehub.dev/docs/auth/diagnostics/auth_c0006) | `defineAuth()` \<label\> does not support the "\<key\>" option. |
| [`AUTH_C0007`](https://vitehub.dev/docs/auth/diagnostics/auth_c0007) | `defineAuth()` \<label\> must use static object keys. |
| [`AUTH_C0008`](https://vitehub.dev/docs/auth/diagnostics/auth_c0008) | `defineAuth()` route can only be `false` when provided. |
| [`AUTH_C0009`](https://vitehub.dev/docs/auth/diagnostics/auth_c0009) | `defineAuth()` access.routes[\<index\>] must start with `/`. |
| [`AUTH_C0010`](https://vitehub.dev/docs/auth/diagnostics/auth_c0010) | `defineAuth()` access.routes[\<index\>] must be an inline route string or route object. |
| [`AUTH_C0011`](https://vitehub.dev/docs/auth/diagnostics/auth_c0011) | `defineAuth()` access.routes[\<index\>].route is required. |
| [`AUTH_C0012`](https://vitehub.dev/docs/auth/diagnostics/auth_c0012) | `defineAuth()` access.routes must be an inline array. |
| [`AUTH_C0014`](https://vitehub.dev/docs/auth/diagnostics/auth_c0014) | `defineAuth()` database must be `authDatabase()` from `vite-hub/auth/database` or `"memory"`. `true` and `{ name }` do not create storage. Return another Better Auth adapter from the Definition callback. |
| [`AUTH_C0017`](https://vitehub.dev/docs/auth/diagnostics/auth_c0017) | `defineAuth()` secondaryStorage takes only a Better Auth adapter, from the Definition callback. `true` and `{ store }` do not create storage. |
| [`AUTH_C0019`](https://vitehub.dev/docs/auth/diagnostics/auth_c0019) | `defineAuth()` options must be an inline object literal. |
| [`AUTH_C0021`](https://vitehub.dev/docs/auth/diagnostics/auth_c0021) | `defineAuth()` database must be `authDatabase()` from `vite-hub/auth/database` or `"memory"`. `true` and `{ name }` do not create storage. Return another Better Auth adapter from the Definition callback. |
| [`AUTH_C0024`](https://vitehub.dev/docs/auth/diagnostics/auth_c0024) | `defineAuth()` secondaryStorage takes only a Better Auth adapter, from the Definition callback. `true` and `{ store }` do not create storage. |
| [`AUTH_C0026`](https://vitehub.dev/docs/auth/diagnostics/auth_c0026) | `defineAuth()` \<label\> must be a non-empty string. |
| [`AUTH_C0027`](https://vitehub.dev/docs/auth/diagnostics/auth_c0027) | `defineAuth()` \<label\> must start with `/`. |
| [`AUTH_C0028`](https://vitehub.dev/docs/auth/diagnostics/auth_c0028) | `defineAuth()` access.signIn must be an object. |
| [`AUTH_C0029`](https://vitehub.dev/docs/auth/diagnostics/auth_c0029) | `defineAuth()` access.signIn.requestSignUp must be a boolean. |
| [`AUTH_C0030`](https://vitehub.dev/docs/auth/diagnostics/auth_c0030) | `defineAuth()` access.signIn.scopes must be an array of strings. |
| [`AUTH_C0031`](https://vitehub.dev/docs/auth/diagnostics/auth_c0031) | `defineAuth()` \<label\> must be a route string or route object. |
| [`AUTH_C0032`](https://vitehub.dev/docs/auth/diagnostics/auth_c0032) | `defineAuth()` \<label\> does not support the "\<unknownKey\>" option. |
| [`AUTH_C0033`](https://vitehub.dev/docs/auth/diagnostics/auth_c0033) | `defineAuth()` \<label\>.authorize must be a function. |
| [`AUTH_C0034`](https://vitehub.dev/docs/auth/diagnostics/auth_c0034) | `defineAuth()` access must be an object. |
| [`AUTH_C0035`](https://vitehub.dev/docs/auth/diagnostics/auth_c0035) | `defineAuth()` access.routes must be an array. |
| [`AUTH_C0036`](https://vitehub.dev/docs/auth/diagnostics/auth_c0036) | `defineAuth()` expects an object or a callback. |
| [`AUTH_C0037`](https://vitehub.dev/docs/auth/diagnostics/auth_c0037) | `defineAuth()` \<runtimeOption\> is resolved at runtime and cannot be defined in the Auth Definition. |
| [`AUTH_C0038`](https://vitehub.dev/docs/auth/diagnostics/auth_c0038) | `defineAuth()` route can only be `false` when provided. |
| [`AUTH_C0039`](https://vitehub.dev/docs/auth/diagnostics/auth_c0039) | `defineAuth()` no longer takes `runtime`. Pass one callback that returns all options, so no option replaces another. |
| [`AUTH_C0040`](https://vitehub.dev/docs/auth/diagnostics/auth_c0040) | `defineAuth()` basePath must be a string. |
| [`AUTH_C0041`](https://vitehub.dev/docs/auth/diagnostics/auth_c0041) | `defineAuth()` session.onRefresh must be a function. |
| [`AUTH_C0042`](https://vitehub.dev/docs/auth/diagnostics/auth_c0042) | `defineAuth()` session.onRefresh needs a Better Auth `database` or `secondaryStorage` adapter. Better Auth refreshes a stateless cookie cache without a hook. |
| [`AUTH_C0043`](https://vitehub.dev/docs/auth/diagnostics/auth_c0043) | `defineAuth()` preset must be a preset such as `stateless()` from `vite-hub/auth/presets`. |
| [`AUTH_C0044`](https://vitehub.dev/docs/auth/diagnostics/auth_c0044) | `stateless()` keeps sessions in cookies and cannot use `database`. Remove `database`, or remove the preset to store sessions in a database. |
| [`AUTH_C0045`](https://vitehub.dev/docs/auth/diagnostics/auth_c0045) | `stateless()` keeps sessions in cookies and cannot use `secondaryStorage`. Remove `secondaryStorage`, or remove the preset to store sessions on the server. |
| [`AUTH_C0046`](https://vitehub.dev/docs/auth/diagnostics/auth_c0046) | `stateless()` has no database to store users and passwords, so `emailAndPassword` cannot be enabled. Use `socialProviders`, or remove the preset and configure a database. |
| [`AUTH_C0047`](https://vitehub.dev/docs/auth/diagnostics/auth_c0047) | `stateless()` has no database, and the Better Auth plugin "\<plugin\>" stores data in one. Remove the plugin, or remove the preset and configure a database. |
| [`AUTH_C0048`](https://vitehub.dev/docs/auth/diagnostics/auth_c0048) | `stateless()` sets `<value>`. Remove it from the Auth Definition, and pass `maxAge` to `stateless()` to change the session lifetime. |
| [`AUTH_C0049`](https://vitehub.dev/docs/auth/diagnostics/auth_c0049) | `stateless({ maxAge })` must be a positive whole number of seconds or a duration such as "7d". Received \<maxAge\>. |
| [`AUTH_C0050`](https://vitehub.dev/docs/auth/diagnostics/auth_c0050) | `defineAuth()` events needs a store with append, list, and aggregate methods. events.authorize and events.onEvent must be functions. Set events to false to disable the log. |
| [`AUTH_C0051`](https://vitehub.dev/docs/auth/diagnostics/auth_c0051) | `<variable>` gives the admin role, which Better Auth's `admin()` plugin stores in `user.role`. Add `admin()` from `better-auth/plugins` to the `plugins` of `defineAuth()`, or unset `<variable>`. |
| [`AUTH_C0052`](https://vitehub.dev/docs/auth/diagnostics/auth_c0052) | `authDatabase()` takes the Database name as one inline string literal, such as `authDatabase("content")`, or no argument for the `default` Database. |
| [`AUTH_C0053`](https://vitehub.dev/docs/auth/diagnostics/auth_c0053) | `authDatabase()` owns tables with text IDs. Use Better Auth's default ID generator or a custom function returning strings; `advanced.database.generateId` cannot be `serial`, `uuid`, or `false`. Use another Better Auth adapter to own a different ID schema. |
| [`AUTH_C0054`](https://vitehub.dev/docs/auth/diagnostics/auth_c0054) | `authDatabase()` needs one statically invariant Database: call it inline as `defineAuth()`'s `database`, in an object or a callback's single unconditional returned object. Do not select it in branches. |
| [`AUTH_C0055`](https://vitehub.dev/docs/auth/diagnostics/auth_c0055) | `authDatabase()` adds a column for each additional field, but \<detail\>. |
| [`AUTH_C0056`](https://vitehub.dev/docs/auth/diagnostics/auth_c0056) | `authDatabase()` cannot store the Better Auth options: \<detail\>. |
| [`AUTH_C0057`](https://vitehub.dev/docs/auth/diagnostics/auth_c0057) | `<removedVariable>` is removed, because an email and password sign-up does not prove that the person owns the email. List the admin's GitHub or other social account in `<adminsVariable>`, such as `<adminsVariable>=github:22072217`, and unset `<removedVariable>`. |
| [`AUTH_C0058`](https://vitehub.dev/docs/auth/diagnostics/auth_c0058) | `<adminsVariable>` has the entry `<entry>`. \<reason\> Each entry is `<provider>:<account id>`, such as `github:22072217`. Find a GitHub account id with `gh api users/<login> --jq .id`. For an app with only email and password sign-in, use a claim code. |
| [`AUTH_C0059`](https://vitehub.dev/docs/auth/diagnostics/auth_c0059) | `<adminClaimVariable>` must be `sha256:` and 64 hex characters. Run `vitehub auth claim` and set the value that it prints. Never set the code itself. |
| [`AUTH_C0060`](https://vitehub.dev/docs/auth/diagnostics/auth_c0060) | See the page of the code. |
| [`AUTH_C0061`](https://vitehub.dev/docs/auth/diagnostics/auth_c0061) | Auth `database` must be a Better Auth adapter, such as `authDatabase()`. `true` and `{ name }` do not create storage, so users and sessions would stay in memory. |
| [`AUTH_C0062`](https://vitehub.dev/docs/auth/diagnostics/auth_c0062) | Auth `secondaryStorage` must be a Better Auth adapter. `true` and `{ store }` do not create storage. |
| [`AUTH_C0063`](https://vitehub.dev/docs/auth/diagnostics/auth_c0063) | `defineAuth()` has no `database` or `preset`. Auth keeps users and sessions in memory only on a development server, because a restart or a second instance loses them. |
| [`AUTH_C0064`](https://vitehub.dev/docs/auth/diagnostics/auth_c0064) | `defineAuth()` access.public must be an inline array. |
| [`AUTH_C0065`](https://vitehub.dev/docs/auth/diagnostics/auth_c0065) | `defineAuth()` access.policy must be an object with an `allow` function and an optional `recheck` of 0 or more milliseconds. |
| [`AUTH_C0066`](https://vitehub.dev/docs/auth/diagnostics/auth_c0066) | `defineAuth()` access.policy needs a Better Auth `database` or `secondaryStorage` adapter. A session that lives only in a cookie cannot be ended. |
| [`AUTH_C0067`](https://vitehub.dev/docs/auth/diagnostics/auth_c0067) | `forwardAuth()` needs a `header` name and a `verify` function. Auth never trusts a forwarded header without `verify`. |
| [`AUTH_C0068`](https://vitehub.dev/docs/auth/diagnostics/auth_c0068) | See the page of the code. |
| [`AUTH_R0001`](https://vitehub.dev/docs/auth/diagnostics/auth_r0001) | authenticated({ map }) must return an Agent Invoker. |
| [`AUTH_R0002`](https://vitehub.dev/docs/auth/diagnostics/auth_r0002) | authenticated({ meta }) must resolve to an object. |
| [`AUTH_R0003`](https://vitehub.dev/docs/auth/diagnostics/auth_r0003) | See the page of the code. |
| [`AUTH_R0004`](https://vitehub.dev/docs/auth/diagnostics/auth_r0004) | Invalid authentication error options. |
| [`AUTH_R0005`](https://vitehub.dev/docs/auth/diagnostics/auth_r0005) | No Auth Definition was discovered. Add `server/auth.ts` or `server.auth.ts`. |
| [`AUTH_R0006`](https://vitehub.dev/docs/auth/diagnostics/auth_r0006) | The request origin is required. |
| [`AUTH_R0007`](https://vitehub.dev/docs/auth/diagnostics/auth_r0007) | The request origin is not trusted. |
| [`AUTH_R0008`](https://vitehub.dev/docs/auth/diagnostics/auth_r0008) | Auth access route \<routeIndex\> is unavailable at runtime. |
| [`AUTH_R0009`](https://vitehub.dev/docs/auth/diagnostics/auth_r0009) | Auth access route indexes must be a non-empty array of non-negative integers. |
| [`AUTH_R0010`](https://vitehub.dev/docs/auth/diagnostics/auth_r0010) | Required Auth authorize route indexes must be an array of non-negative integers. |
| [`AUTH_R0011`](https://vitehub.dev/docs/auth/diagnostics/auth_r0011) | Better Auth did not expose api.getSession(). |
| [`AUTH_R0012`](https://vitehub.dev/docs/auth/diagnostics/auth_r0012) | Better Auth returned an invalid session response. |
| [`AUTH_R0013`](https://vitehub.dev/docs/auth/diagnostics/auth_r0013) | `defineAuth()` basePath must start with `/`. |
| [`AUTH_R0014`](https://vitehub.dev/docs/auth/diagnostics/auth_r0014) | `authorize` must be a function. |
| [`AUTH_R0015`](https://vitehub.dev/docs/auth/diagnostics/auth_r0015) | withAnonymousAuthorization() requires a handler function. |
| [`AUTH_R0016`](https://vitehub.dev/docs/auth/diagnostics/auth_r0016) | VITEHUB_SECRET must be at least \<viteHubSecretMinimumLength\> characters. Generate one with `openssl rand -base64 32`. |
| [`AUTH_R0018`](https://vitehub.dev/docs/auth/diagnostics/auth_r0018) | Auth events are disabled. Configure events.store in defineAuth(). |
| [`AUTH_R0019`](https://vitehub.dev/docs/auth/diagnostics/auth_r0019) | `authDatabase(<name>)` found no Better Auth tables in the \<name\> Database. Pass `authDatabase()` inline as the `database` of `defineAuth()` so that Auth adds them, enable the Database integration, and run `vitehub database generate`. `vitehub inspect definitions --kind database` lists the tables of each Database. |
| [`AUTH_R0020`](https://vitehub.dev/docs/auth/diagnostics/auth_r0020) | There is no ability named \<name\>. Add it to shared/abilities.ts with defineAbilities(). |
| [`AUTH_R0021`](https://vitehub.dev/docs/auth/diagnostics/auth_r0021) | The ability \<name\> returned a Promise. Rules also run in the browser, so they must return at once. Load the data first and pass it to the rule. |
| [`AUTH_R0022`](https://vitehub.dev/docs/auth/diagnostics/auth_r0022) | The request host \<host\> is not an origin of vitehub({ publicUrl }), so Auth has no base URL. |
| [`AUTH_R0023`](https://vitehub.dev/docs/auth/diagnostics/auth_r0023) | `forwardAuth()` verify returned a value that is not an identity. Return `null`, or an object with `providerId`, `accountId`, `email`, `name`, and `emailVerified`. |

## Errors

| Code | What happened |
| --- | --- |
| [`AUTH_CONSOLE_FORBIDDEN`](https://vitehub.dev/docs/auth/diagnostics/auth_console_forbidden) | The app policy or Better Auth session does not permit this action. |
| [`AUTH_CONSOLE_INVALID_REQUEST`](https://vitehub.dev/docs/auth/diagnostics/auth_console_invalid_request) | The Auth Console request does not match its field or pagination contract. |
| [`AUTH_CONSOLE_NOT_FOUND`](https://vitehub.dev/docs/auth/diagnostics/auth_console_not_found) | The requested Auth record or plugin is not available. |
| [`AUTH_CONSOLE_PROVIDER_FAILED`](https://vitehub.dev/docs/auth/diagnostics/auth_console_provider_failed) | Better Auth or an app column reader could not complete the operation. |
| [`AUTH_CONSOLE_UNAVAILABLE`](https://vitehub.dev/docs/auth/diagnostics/auth_console_unavailable) | Auth does not have the database or plugin API needed for this operation. |
| [`AUTH_EVENT_CALLBACK_FAILED`](https://vitehub.dev/docs/auth/diagnostics/auth_event_callback_failed) | `events.onEvent` failed for the \<type\> auth event. Auth kept the change and the stored event. |
| [`AUTH_EVENT_QUERY_INVALID`](https://vitehub.dev/docs/auth/diagnostics/auth_event_query_invalid) | Auth event windows must be positive and at most 366 days. |
| [`AUTH_EVENT_RETENTION_INVALID`](https://vitehub.dev/docs/auth/diagnostics/auth_event_retention_invalid) | Auth event retention limits must be positive integers. |
| [`AUTH_PASSWORD_HASH_INVALID`](https://vitehub.dev/docs/auth/diagnostics/auth_password_hash_invalid) | Invalid password hash |
| [`AUTH_SIGN_OUT_REDIRECT_INVALID`](https://vitehub.dev/docs/auth/diagnostics/auth_sign_out_redirect_invalid) | `signOut()` redirects only to a path of the app, not to \<redirectTo\>. |

## CLI errors

| Code | What happened |
| --- | --- |
| [`AUTH_EVENTS_OPTION_INVALID`](https://vitehub.dev/docs/auth/diagnostics/auth_events_option_invalid) | Unknown auth events option: \<option\> |
| [`AUTH_EVENTS_REQUEST_FAILED`](https://vitehub.dev/docs/auth/diagnostics/auth_events_request_failed) | Auth events returned HTTP \<status\>. |
| [`AUTH_EVENTS_URL_INSECURE`](https://vitehub.dev/docs/auth/diagnostics/auth_events_url_insecure) | Auth events requires HTTPS or a loopback HTTP URL. |
| [`AUTH_EVENTS_URL_MISSING`](https://vitehub.dev/docs/auth/diagnostics/auth_events_url_missing) | `vitehub auth events` has no Auth base URL. |

## Test errors

| Code | What happened |
| --- | --- |
| [`AUTH_TEST_SIGN_IN_STATELESS`](https://vitehub.dev/docs/auth/diagnostics/auth_test_sign_in_stateless) | `signIn()` writes the user and the session to the Auth database, and a Definition with the `stateless()` preset has none. |

<!-- vitehub-docs:section-links -->
## In this section

- [Overview](https://vitehub.dev/raw/docs/auth.md)
- [Get started](https://vitehub.dev/raw/docs/auth/get-started.md)
- [Configure](https://vitehub.dev/raw/docs/auth/configure.md)
- [Server API](https://vitehub.dev/raw/docs/auth/server-api.md)
- [Hosts](https://vitehub.dev/raw/docs/auth/hosts.md)
- [Limits and errors](https://vitehub.dev/raw/docs/auth/limits-and-errors.md)
- [Console](https://vitehub.dev/raw/docs/auth/console.md)
- [Event log](https://vitehub.dev/raw/docs/auth/events.md)
- [Abilities](https://vitehub.dev/raw/docs/auth/abilities.md)
- [Protect pages](https://vitehub.dev/raw/docs/auth/protect-pages.md)

All pages: [llms.txt](https://vitehub.dev/llms.txt)
