Guide
Supabase "Database error saving new user": the causes and how to fix each
Updated
A new person signs up and gets "Database error saving new user". The account is not created and they cannot get in. Supabase has an official troubleshooting page with this exact title (Database error saving new user).
What the error means
Supabase says the error is normally a side effect of a database transaction: something that runs inside the database when a new row is added to auth.users fails, and the user is not saved. Its error reference adds that a 500 from Auth "most often" points to the database setup, "such as a misbehaving trigger".
The first common cause Supabase lists is a trigger on auth.users that has an error, such as one that copies each new user into a profiles table. Supabase's own guide warns: "If the trigger fails, it could block signups, so test your code thoroughly."
The causes, and how to fix each one
Supabase's debugging order is: Auth logs first, then the Postgres logs.
0. Find the real error
The message on screen is generic. The database log is not.
How to fix it
- In the Supabase dashboard, open the Auth logs and find the failed sign-up.
- If it points to the database, open the Postgres logs at the same time and read the error line.
- Match it to a cause below.
Source: Supabase troubleshooting: Database error saving new user
1. The trigger writes to a table that does not exist
The Postgres log shows a "relation ... does not exist" message, for example for profiles. The trigger function (often handle_new_user) inserts into a table that was never created, or was accidentally dropped.
How to fix it
- If the table should exist in the
publicschema, create it. - If it is not needed, open Database Functions in the dashboard and update or remove the reference in the function.
Source: Supabase troubleshooting: Database error saving new user
2. The trigger function itself errors
Supabase lists "a trigger/trigger function setup on the auth.users table that has an error" as a cause. Whatever the error is, the sign-up fails with it.
How to fix it
- Read the Postgres error line to see which statement failed.
- Compare the function with Supabase's reference version: it is declared
security definer set search_path = '', writes to the fully named tablepublic.profiles, and reads optional fields fromnew.raw_user_meta_data. - Make every column the function fills either optional or always provided by your sign-up form.
- Test by signing up a new address, then check that the profile row appears.
Source: Supabase: User management
3. A constraint on the users table is not met
Supabase lists a constraint added on auth.users that is not being met as a cause.
How to fix it
- Look in the Postgres logs for the failing constraint.
- Remove or relax a constraint you added yourself, or make the sign-up provide the value it needs.
Source: Supabase troubleshooting: Database error saving new user
4. Related: users were inserted directly with SQL or by an AI tool
Auth expects empty strings in some columns. Users added with a direct SQL INSERT, rather than through the Auth API, can leave them NULL. Supabase lists this on the same page, though its example error reads "Database error querying schema" and names the column, for example with "converting NULL to string is unsupported."
How to fix it
- Run Supabase's fix in the SQL editor, using the column the error names:
update auth.users set confirmation_token = '' where confirmation_token is null; - Create users through the Auth API from now on, not with direct inserts.
Source: Supabase troubleshooting: Database error saving new user
5. A tool changed the permissions on the users table
Supabase lists Prisma breaking the permissions on auth.users as a known cause.
How to fix it
- Check the Postgres logs for errors on the auth schema.
- Keep tools that manage your own tables away from the
authschema.
Source: Supabase troubleshooting: Database error saving new user
Why you cannot see it yourself
You're signed in, your customers aren't. Your own account already exists, so you never run the trigger again. It only fires for a brand-new person, which is exactly who meets the error.
Frequently asked questions
It worked until I added a profiles table. What broke?
In one reply on a WeWeb community thread about a 500 on sign-up, the cause was an error in a trigger function that wrote new users to a public table. Read the Postgres log line, then fix the function or the table (causes 1 and 2).
Does this error mean the email or the password is wrong?
No. It is raised by the database while saving the new user. Nothing the person types fixes it; the fix is in your project.
I get it when I invite a user from the dashboard. Same cause?
Yes. Supabase's troubleshooting page says the error often appears when inviting a user from the dashboard or inserting one in the table editor. The same trigger runs for every new user.
Can VibeFix fix it for me?
Yes, if you ask. The free check confirms the problem first. Our AI agent can find the cause, fix it in your code and re-check your live app: $79 for one bug, paid up front. If we can't complete your re-check, you get your money back.
Related guides
- Row-level security error saving a profile right after sign-up
- "new row violates row-level security policy"
- Supabase "permission denied for table" (42501)
- Supabase "Error sending confirmation email" (500)
- Sign-up or login broken after publishing
- The AI says it fixed it, but my app is still broken
Sources (official documentation)
- Supabase troubleshooting: Database error saving new user
- Supabase: User management (profiles table and trigger)
- Supabase: Auth error codes (500 and database triggers)
Fixed it? Prove a real stranger gets in
After the fix, the proof is a brand-new address signing up and getting in, with its profile row created. Your own account cannot show that, because it is not new. Your AI reads your code. VibeFix signs up like a stranger.
Free check. An AI agent signs up to your live app as a brand-new person, with a real inbox of its own, on a phone and on a computer. You get the problem count, what each problem is, and one screenshot. It never changes your app and never emails your users. Test my app, free
VibeFix is independent. Supabase, Prisma, Lovable, Bolt and Base44 are trademarks of their owners.
Want it fixed?
Our AI agent finds the cause, fixes it in your code and re-checks your live app. $79 for one bug, paid up front. If we can't complete your re-check, you get your money back.
It starts with a free check that confirms the problem on your live app, no account needed.