VibeFix

Guide

Database error querying schema (Supabase Auth 500)

Published by Yosef D., founder of VibeFix

How this guide was made: Written with AI assistance and checked against the sources linked on this page.

Updated

Short answer

"Database error querying schema" is a 500 error from Supabase Auth. It can mean a row in auth.users has NULL in a column where Auth expects text or an empty string. This can happen after users were added or edited with SQL. Find the column in your Auth logs, then set its NULLs to ''. It can mean a row in auth.users has NULL in a column where Auth expects text or an empty string. This can happen after users were added or edited with SQL. Find the column in your Auth logs, then set its NULLs to ''.

Get it fixed: a free check first confirms the problem on your live app, usually in 4 to 10 minutes.

Free. No account needed. It usually takes 4 to 10 minutes.

Want it fixed? Our AI agent fixes it in your code for $79 and tests your live app again. If we can't complete your re-check, you get your money back.

What it means

Supabase Auth reads the user's row from auth.users when someone signs in. Some columns in that table must hold a string, even if it is an empty one. When Auth finds NULL in one of them, it can't read the row, so it stops and returns a 500 with this message.

The Auth API fills those columns in correctly when it creates a user. The problem appears when rows get into auth.users some other way. Some ways are a seed script, a migration, an INSERT copied from a tutorial, or a manual edit in the table editor.

The problem sits in the data of one table, so your app's code may be fine. That's why the error can show up for some accounts and not others, and why it can come back after a database reset that re-runs a seed file.

Causes

CauseHow to tellFix
Users were inserted into auth.users with SQL (seed file, migration, copied script)Auth logs show a scan error on a named column of auth.users. The failing accounts are the ones the script createdSet that column's NULLs to '' (step 3). Create future users through the Auth API (step 5)
A user row was edited by hand and a value was clearedOnly one or a few accounts fail. Their rows show NULL in a text column that other rows have as emptySame SQL fix, limited to that column (step 3)
A seed file re-creates the bad rows on every resetThe error disappears after the fix, then returns after supabase db reset or a fresh environmentFix the seed file itself (step 5), not just the data

How to fix it

  1. Read the Auth log line. In the Supabase dashboard, open Logs, then Auth. Find the request that returned 500 with "Database error querying schema". Write down the column the log names. A typical line reads error finding user: sql: Scan error on column "confirmation_token": converting NULL to string is unsupported, which means the column is confirmation_token. If the Auth log points at the database without naming a column, open the Postgres logs for the same minute.
  1. Count the NULLs in that column. In the SQL Editor, run this with your column name:
   SELECT count(*) AS null_rows
   FROM auth.users
   WHERE confirmation_token IS NULL;
   

To see which accounts are affected:

   SELECT id, email, created_at
   FROM auth.users
   WHERE confirmation_token IS NULL;
   

If the count is 0, you have the wrong column. Go back to the log line.

  1. Replace the NULLs with empty strings. This is the fix from Supabase's troubleshooting guide. Run it for the column named in the log:
   UPDATE auth.users
   SET confirmation_token = ''
   WHERE confirmation_token IS NULL;
   

If the log names a different column, swap it in:

   UPDATE auth.users
   SET <column_name> = ''
   WHERE <column_name> IS NULL;
   

Change only the column the log names. Some columns in auth.users are allowed to be NULL, so don't run this over every column.

Get it fixed: a free check first confirms the problem on your live app, usually in 4 to 10 minutes.

Free. No account needed. It usually takes 4 to 10 minutes.

Want it fixed? Our AI agent fixes it in your code for $79 and tests your live app again. If we can't complete your re-check, you get your money back.

  1. Try the sign-in again. If a new 500 appears and the log names another column, repeat steps 2 and 3 for that column. Rows made by one bad script can have NULLs in more than one place.
  1. Stop it coming back. Find the script that wrote into auth.users (look in supabase/seed.sql, your migrations folder, or any setup script) and stop inserting users with raw SQL. Create them through the Auth API instead, from a server-side script that uses your service role key:
   import { createClient } from "@supabase/supabase-js";

   const supabase = createClient(
     process.env.SUPABASE_URL!,
     process.env.SUPABASE_SERVICE_ROLE_KEY! // server only, never in the browser
   );

   const { data, error } = await supabase.auth.admin.createUser({
     email: "test@example.com",
     password: "a-long-test-password",
     email_confirm: true,
   });

   if (error) throw error;
   console.log("created", data.user.id);
   

If you must keep a SQL seed, give every text column Auth reads an explicit '' in the INSERT instead of leaving it out.

How to check it's fixed

FAQ

Is it safe to set these columns to an empty string?

Yes, for the column the Auth log names. Supabase's own fix for this error is to turn its NULL values into empty strings, because that's what Auth expects to find. Only change the column the log points to.

Why did this start after I ran a seed script or migration?

Because those write straight into auth.users and skip the Auth API, which is what normally fills these columns. Fix the existing rows with step 3, then change the script (step 5) so the next reset doesn't bring the error back.

How is this different from "Database error saving new user"?

That one happens while a user is being created, for example because a trigger on auth.users fails. This one happens when Auth reads an existing user, such as at sign-in. If you see the other message, read our guide to Database error saving new user.

Can VibeFix fix it for me?

Yes, for apps built in Lovable or any app whose code is on GitHub. The free check confirms the problem on your live app first. If you want it fixed, our AI agent finds the cause, fixes it in your code for $79 and tests your live app again. See pricing.

Sources

Last checked: 16 November 2026.

VibeFix is independent. Supabase is a trademark of its owner.

Want it fixed?

Our AI agent fixes it in your code for $79 and tests your live app again. 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.

Check my app free

More guides · Shopify store accessibility · About · Your privacy choices