Back to feed
Dev.to
Dev.to
5/12/2026
Silent errors in Supabase mutations: Three patterns to prevent production failures

Silent errors in Supabase mutations: Three patterns to prevent production failures

Original: Why your Supabase mutations lie about their errors

Short summary

Supabase mutations return {data, error} objects instead of throwing exceptions, which means errors disappear silently if developers don't explicitly check them. The author shows a production incident where undestructured await hid the true error—users saw an FK constraint violation while the actual problem was a CHECK constraint three lines earlier. Three patterns prevent this: explicit error destructuring, .throwOnError() for exception-like behavior, or an ESLint rule to catch bare awaits in the codebase.

  • Supabase mutations don't throw; they return {data, error} objects that fail silently if not handled
  • Silent failures cause confusing downstream errors in production while the actual root cause remains hidden
  • Enforce explicit error handling via destructuring, .throwOnError(), or an ESLint linter rule

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Explore more