Supabase error user_not_found (user_not_found) explained: what it means, why it happens, and how to fix it — with copy-paste code examples.
For sign-in flows, treat missing users as invalid_credentials to avoid user enumeration. If that does not apply, use getUserById or listUsers before acting on a user id — the full checklist is below.
Error code: user_not_found
Official name: user_not_found
Service: Supabase
User not found.
const { data: { user }, error } = await supabaseAdmin.auth.admin.getUserById(id)
if (error?.code === 'user_not_found') {
console.log('no such user:', id)
}
The admin API returns user_not_found for unknown ids - handle it before writing user-related rows.
In admin flows, branch on the code to guide operators to create or invite the user.
const { data, error } = await supabaseAdmin.auth.admin.getUserById(userId)
if (error?.code === 'user_not_found') {
showPrompt('User does not exist. Create or invite them?')
}
Most often this happens when admin API query for a deleted or non-existent user id, or when password recovery flow for an email that never signed up.
For sign-in flows, treat missing users as invalid_credentials to avoid user enumeration.
This page documents fixes for: supabase-js.
Recommendations are editorial — DB Error Reference takes no payment or affiliate fees for tool listings.
This page is based on the official Supabase documentation linked below and adds practical troubleshooting guidance on top.