Errors

NUXT_AUTH_SCHEMA_GENERATION_FAILED: Auth schema generation failed

Resolve an underlying plugin, filesystem, or schema-generation error during Nuxt setup.
Example error
[NUXT_AUTH_SCHEMA_GENERATION_FAILED] Failed to generate schema: EACCES: permission denied, mkdir .nuxt/better-auth

Why this happens

Schema setup threw an error outside the more specific config diagnostics. The original cause is retained. This can come from a plugin hook, the schema generator, or writing generated files; setup fails in both development and production.

How to fix it

Check the underlying error, auth configuration, and write access to the Nuxt build directory, then regenerate the schema.

For the permission error above, check that the user running Nuxt can write to the configured build directory. Avoid alternating between privileged and unprivileged builds of the same checkout. After correcting directory ownership or permissions, rerun:

pnpm exec nuxt prepare

For a plugin error, inspect the original cause and the most recent plugin or better-auth:config:extend change. A filesystem fix will not resolve a plugin exception.

Verify the fix

Preparation should finish successfully. Check the generated schema for all expected fields and tables before creating a migration.

See Generate and review the schema or return to the error reference.