Fix guide · updated 2026-11-09
Bolt error 500 (Internal Server Error): find which part of your app failed and fix it
500 (Internal Server Error) · Edge Function returned a non-2xx status code · Database error saving new user · infinite recursion detected in policy
Your Bolt app shows 500 or Internal Server Error, or a red line in the browser console says the server responded with a status of 500. A 500 only says that a server hit an error it didn't handle. It doesn't say which server, or why. In a Bolt app, several different places can send one, and the address of the failing request tells you which. Find that first, then read the real error behind it.
1. Find the request that failed
In Chrome, open the console (Ctrl + Shift + J on Windows, Cmd + Option + J on a Mac) and make the error happen again. Look for a red line like this one:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
Next to it is the address that failed. The Network tab lists the same requests with their status codes. Match the address:
- It contains
/functions/v1/, or your app saysEdge Function returned a non-2xx status code: one of your server functions failed. Go to step 2. - It contains
/auth/v1/, usually when someone signs up: Supabase Auth failed. Go to step 3. - It contains
/rest/v1/: a database query failed. Go to step 4. - It ends with one of your project's files, like
/src/App.tsx, and the preview is blank or shows an error panel: that file doesn't compile. Go to step 5. - Bolt itself is failing, not your app: the editor, the chat or the preview won't work. Go to step 6.
2. A server function returned 500
Server functions (Supabase calls them Edge Functions) run the backend part of your app: payments, emails, calls to AI services. When one crashes or returns an error, the Supabase client in your app only reports Edge Function returned a non-2xx status code. The function's own error message is in the response it sent back. There are two ways to read it:
- The logs. On a Bolt database, click the database icon at the top of your project, then Server Functions, then View Logs on the function. Bolt only shows the last hour, so make the error happen first and look right away. On your own Supabase project, open the function from the Edge Functions page of the dashboard and check its logs.
- The response itself. Supabase's docs show how to print the function's error from your app's code:
import { FunctionsHttpError } from '@supabase/supabase-js'
const { data, error } = await supabase.functions.invoke('my-function', { body })
if (error instanceof FunctionsHttpError) {
console.error('Function error', await error.context.json())
}
Ask Bolt to add that check, make the error happen again, and the console shows what the function actually said. The usual causes:
- A missing secret. Functions read keys like
STRIPE_SECRET_KEYorRESEND_API_KEYfrom secrets. If one doesn't exist, the function fails as soon as it calls that service. Bolt warns you with a message likeThe following secrets are used in the code but don't exist yet: RESEND_API_KEY. Add it under database icon → Secrets, with the name spelled exactly as in the message: names are case-sensitive. - A wrong or expired key. The secret exists, but the outside service rejects it, and the log shows that service's own error. Copy a fresh key from the service's dashboard and save it as the secret's value.
- A crash in the function's code, for example reading a field the app didn't send. The log shows the error and where it happened. Paste that log entry into Bolt and ask it to fix the function. Bolt redeploys server functions for you after each change.
If the message is Failed to send a request to the Edge Function instead, your app couldn't read any answer from the function. From a browser, the usual reason is CORS: the function doesn't answer the browser's OPTIONS check, sent before the real request, or its answer lacks the CORS headers. Edge Function returned a non-2xx status code covers that fix and every status code a function can return.
3. Sign-up fails with "Database error saving new user"
This 500 comes from Supabase Auth while it creates the account. The cause is usually not Auth itself but a trigger: many apps run a function for every new user that copies them into a profiles table. When that function fails, the sign-up fails with it, and Auth only returns this generic message. Supabase's docs warn about exactly this: a failing trigger can block sign-ups.
To see the real error, open the logs right after a failed sign-up. On a Bolt database, that's database icon → Logs, then PostgreSQL or Authentication in the dropdown. On your own Supabase project, it's the Logs page of the dashboard. Then compare your function with Supabase's example:
create function public.handle_new_user()
returns trigger
language plpgsql
security definer set search_path = ''
as $$
begin
insert into public.profiles (id, first_name, last_name)
values (new.id, new.raw_user_meta_data ->> 'first_name', new.raw_user_meta_data ->> 'last_name');
return new;
end;
$$;
security definermakes the function run with its owner's rights. Without it, the function runs as Supabase Auth's own database role, which can't write to your tables.set search_path = ''means every table needs its schema:public.profiles, notprofiles. Without the schema, the log says the table doesn't exist.- The columns must match your table. A required (
not null) column the function doesn't fill, or a column that was renamed since, makes every sign-up fail.
Each error the log can show here, with its fix, is in Database error saving new user.
4. A database query returns 500
Most database errors come back as a 400, 401 or 403. A 500 from /rest/v1/ is rarer, and in apps like these it's usually one of two errors:
infinite recursion detected in policy for relation "...": a security policy reads its own table, or two tables' policies read each other, so Postgres can never finish checking. It's common with sharing and admin features.canceling statement due to statement timeout: the query ran too long, often a page that loads a whole table at once. Ask Bolt to load the rows in pages, with.range(), and to select only the columns the page shows.
For the recursion, Supabase's documented fix moves the lookup into a security definer function in a private schema, then calls that function from the policy. Here's their example, for lists shared with members. Drop the old policy first, since the new one takes its name:
create schema if not exists private;
create function private.user_list_ids()
returns setof uuid
language sql
security definer
set search_path = ''
stable
as $$
select list_id from public.list_members
where user_id = (select auth.uid())
$$;
revoke execute on function private.user_list_ids() from public;
grant usage on schema private to authenticated;
grant execute on function private.user_list_ids() to authenticated;
create policy "members read lists" on lists for select
to authenticated
using ( id in (select private.user_list_ids()) );
Keep that function out of the public schema. A security definer function in a schema your API exposes can be called by anyone, with its owner's rights. You can paste this example into Bolt and ask it to apply the same pattern to your own tables. How to find the policy behind the loop, the admin and team versions of the fix, and the errors that can follow it are in Infinite recursion detected in policy.
If you get a 403 or permission denied for table instead, that's a different problem with its own fix: see Supabase permission denied for table (42501).
5. The preview is blank and one of your files returns 500
Bolt's preview runs a development server inside your browser. When one of your files has an error that stops it from compiling, that server answers with a 500 for that file, and the page stays blank. We reproduced it with a missing closing tag in src/App.tsx. The console showed the 500 for /src/App.tsx, and the error panel over the page gave the real message, with the line and column:
[plugin:vite:react-babel] …/src/App.tsx: Unterminated JSX contents. (6:10)
So the fix is in that file, at that line, not on a server. Copy the panel's message, or the red text from the Terminal tab in Code view, into Bolt and ask it to fix that line. That's also Bolt's own advice for a blank preview: give it the exact error. Running npm run build in the terminal shows compile errors too. Most Bolt and Lovable web apps are built with the same tool, Vite, so the messages are the same: Lovable build unsuccessful shows how to read the common ones.
6. Bolt itself is failing
If Bolt's editor, chat or preview fails rather than your app, check status.bolt.new first. During an incident, wait and try again later. If there's no incident, Bolt's troubleshooting guide suggests turning off ad blockers and other extensions, and your VPN, then trying again. If Bolt says your project is too large for a prompt, its docs suggest removing unused files and splitting large files into smaller ones.
Still stuck?
Write down three things: the failing address, its status code, and the real error from the logs or the response. That's what anyone helping you will ask for first, and for a server function, the real error often points straight to the line to fix.
Other Bolt app problems? See Fix a Bolt app.