Supabase User Not Found Error

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.

Error code user_not_found Supabase Last verified 2026-08-19

Quick Answer

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

Error code: user_not_found
Official name: user_not_found
Service: Supabase

What does this error mean?

User not found.

Common Causes

How to Fix

  1. For sign-in flows, treat missing users as invalid_credentials to avoid user enumeration
  2. Use getUserById or listUsers before acting on a user id
  3. Route 'user not found' to sign-up in admin UIs
  4. Verify the user exists in the correct Supabase project

Code Examples

Check user existence via admin API javascript
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.

Framework-Specific Fixes

supabase-js

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?')
}

You Might Also Like

Frequently Asked Questions

Why am I seeing Supabase error user_not_found?

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.

How do I fix Supabase error user_not_found?

For sign-in flows, treat missing users as invalid_credentials to avoid user enumeration.

Which frameworks have documented fixes for error user_not_found?

This page documents fixes for: supabase-js.

Official Sources

This page is based on the official Supabase documentation linked below and adds practical troubleshooting guidance on top.