Guide
"Database error saving new user" on sign-up (Lovable, Bolt, Supabase)
Short answer: A database transaction that runs as a side effect of creating the user is failing, most often because of a trigger on auth.users that errors, a constraint that isn't met, or a NULL in an auth column. Read the Auth logs and then the Postgres logs, and fix the trigger, table or column the error names.
Why it happens
Supabase says this error is normally associated with a side effect of a database transaction. You generally get it when inviting a new user from the dashboard, when inserting a user into a table using the table editor, or in logs in connection to failed signups.
The common causes Supabase lists are:
- You have a trigger or trigger function set up on the
auth.userstable that has an error. - You have added a constraint on the
auth.userstable which isn't being met. - You are using Prisma and it has broken all the permissions on the
auth.userstable.
Two specific errors show up often.
NULL value in an auth schema column. The Auth log shows 500: Database error querying schema and error finding user: sql: Scan error on column index 8, name "confirmation_token": converting NULL to string is unsupported. The auth schema is managed by Supabase and expects specific column formats. This typically happens when users are inserted directly via SQL, or by an AI tool that uses a direct SQL INSERT rather than through the Auth API. A direct insert can leave required columns as NULL when the Auth service expects an empty string.
Relation does not exist. The Auth log shows failed to close prepared statement: ERROR: current transaction is aborted, commands ignored until end of transaction block (SQLSTATE 25P02): ERROR: relation "profiles" does not exist (SQLSTATE 42P01). The Postgres log shows relation "profiles" does not exist with context PL/pgSQL function public.handle_new_user() line 3 at SQL statement. A trigger on auth.users is calling a function that tries to insert into a table that does not exist. This is common when a profiles table is referenced in a trigger function but was never created, or was accidentally dropped.
Supabase also notes that if a trigger fails, it could block signups, so test your code thoroughly.
How to fix it
- Find out which backend your Lovable project uses. In the Lovable interface, click the Cloud icon on the top bar of your project editor. If the page shows a menu and screens to manage your Database tables and Users from within Lovable, your backend is managed by Lovable Cloud. If the page displays the Supabase icon, your Supabase project name, and links that direct you to the Supabase Dashboard, your project is connected to a Supabase project you manage directly.
- Open the Auth logs. In Supabase, start in the Auth logs explorer in your project dashboard. The logs surface the specific error message and give you the most direct signal about what went wrong. In Lovable, go to More → Cloud → Logs and choose Authentication logs. In Bolt, click the database icon in the top center of your screen, click Logs, and in the dropdown select Authentication.
- If the Auth logs point to a database-level issue, open the Postgres logs explorer to look for corresponding errors. In Lovable, choose PostgreSQL logs in the same Logs screen. In Bolt, choose PostgreSQL in the same dropdown.
- If the error is
converting NULL to string is unsupportedon a column, run this in the SQL editor, replacingconfirmation_tokenwith whichever column appears in your error message:
This sets allNULLvalues in that column to an empty string, which is what the Auth service expects.update auth.users set confirmation_token = '' where confirmation_token is null;
- If the error is
relation "profiles" does not exist, check whether the missing table should exist in yourpublicschema. If it should, create the table for the trigger to succeed and the error should resolve. If the table is not needed, review the function definition and update or remove the reference. You can view and edit your database functions from the Database Functions page in the dashboard. - If you keep a
public.profilestable, make sure the trigger that fills it is sound. Supabase's example function ispublic.handle_new_user()withsecurity definer set search_path = '', inserting intopublic.profilesfromnew.id,new.raw_user_meta_data ->> 'first_name'andnew.raw_user_meta_data ->> 'last_name', and the trigger ison_auth_user_createdafter insert onauth.usersfor each row. - If you access user data through the API, create your own user tables in the
publicschema rather than readingauth.usersdirectly. For security, the Auth schema is not exposed in the auto-generated API. Enable Row Level Security on that table and grant only the privileges each role needs. Referenceauth.usersand specifyon delete cascadein the reference.
How to check it worked on your live app
Open a private window and sign up with a fresh email address you have not used before. Do the failing action: submit the sign-up form. Then open the Auth logs again and confirm the new entry no longer shows the error you fixed. In Lovable that is More → Cloud → Logs with Authentication logs selected; in Bolt it is the database icon, then Logs, then Authentication. Logs do not stream live in Lovable, so click Refresh to load new entries.
Prompt to paste into your AI builder
Paste this into your AI builder: "Sign-up is failing with 'Database error saving new user'. If the Auth logs show a trigger on auth.users is failing, please show me the current definition of the handle_new_user function and the on_auth_user_created trigger before changing anything. Then either create the missing public.profiles table that the trigger inserts into, or update the function so it no longer references a table that does not exist. Keep the function as security definer with search_path set to empty, and keep the insert into public.profiles using new.id and the first_name and last_name fields from raw_user_meta_data. If instead the Auth logs show a NULL value in an auth column, tell me which column it is and show me the update statement before running it. Show me the change first, then apply it."
FAQ
Where do I see the actual error text? Start in the Auth logs explorer in your project dashboard. The logs surface the specific error message. If the Auth logs point to a database-level issue, open the Postgres logs explorer to look for corresponding errors.
Why does a trigger on auth.users break sign-up? Supabase notes that if the trigger fails, it could block signups. A trigger that calls a function inserting into a table that does not exist is one of the common causes of this error.
Can a direct SQL insert cause this? Yes. The NULL column error typically happens when users are inserted directly via SQL or using an AI tool that uses a direct SQL INSERT rather than through the Auth API. A direct insert can leave required columns as NULL when the Auth service expects an empty string.
I use Lovable Cloud and can't open the Supabase dashboard. What now? With Lovable Cloud, the Supabase instance is owned and managed by Lovable, not by your personal Supabase account. You won't see this project in your Supabase Dashboard. Use the Logs screen inside Lovable instead: More → Cloud → Logs.
Where are the logs in Bolt? Click the database icon in the top center of your screen, click Logs, and in the dropdown select the type of logs you want to view.
Related guides
- Sign-up or login broken after publishing (Supabase redirect URLs) — when the sign-up flow breaks only on the live site.
- Data won't save: 'new row violates row-level security policy' — the other database error that stops a write during sign-up.
- The AI says it fixed it, but it's still broken: how to stop the loop — when the builder keeps replying that it is fixed.
Sources
- Database error saving new user
- User Management
- Logs - Lovable Documentation
- Database logs - Bolt
- Identifying Lovable backend: Lovable Cloud or Supabase
- Can't Access Supabase Project When Using Lovable Cloud
VibeFix's check can show this on your live app: its AI agent signs up to your app like a new person, uses it on a phone and a computer, and shows what breaks. VibeFix checks; it does not fix your app.
Last checked: 18 October 2026, against the sources listed above.
VibeFix is independent. Lovable, Bolt, Replit, Base44, v0 and Supabase are trademarks of their owners.
Still stuck?
Paste your app’s link for a free sign-up check, no account needed. An AI agent signs up to your live app as a brand-new person, on a phone and a computer, and tells you whether a new person can finish.