---
title: "Discussion on \"Fixing \"new row violates row-level security policy\" in Supabase\" | Hashnode"
description: "Discussion on \"Fixing \"new row violates row-level security policy\" in Supabase\". If your app shows \"new row violates row-level security policy for table\" (Postgres code 42501), the short answer:\n\nPostgres refused the row because no policy's WITH CHECK allows it for the role making"
url: "https://hashnode.com/posts/fixing-new-row-violates-row-level-security-policy-in-supabase/6ad4711c6eadcac92c5c628d"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Fixing "new row violates row-level security policy" in Supabase](https://stacksmesh.hashnode.dev/fixing-new-row-violates-row-level-security-policy-in-supabase?utm_source=hashnode&utm_medium=feed)

If your app shows "new row violates row-level security policy for table" (Postgres code 42501), the short answer: Postgres refused the row because no policy's WITH CHECK allows it for the role making

Oct 18 · 5 min read · stacksmesh.hashnode.dev  
Read the article

-   [#supabase](https://hashnode.com/tag/supabase)
-   [#postgresql](https://hashnode.com/tag/postgresql)
-   [#security](https://hashnode.com/tag/security)

## Written by

[Ahmed Hassan Yaseen](https://hashnode.com/@ahmedhassanyaseen)

@ahmedhassanyaseen

  
[View profile](https://hashnode.com/@ahmedhassanyaseen)

Founder of StacksMesh. I make AI-built apps production-ready.

Founder and CEO of StacksMesh (stacksmesh.com). We fix, launch and migrate apps built with Base44, Lovable, Bolt and Replit, with a fixed price in writing before any work. I write about making AI-built apps safe and production-ready.

## Responses 1

Markdown supported · ⌘↵ to post

[Last Mile](https://hashnode.com/@lastmilekit)

[Oct 21](https://hashnode.com/posts/fixing-new-row-violates-row-level-security-policy-in-supabase/6ad4711c6eadcac92c5c628d/comment/6ad9308ed26e237a1c7b2b99)

Nice walkthrough. One thing worth adding to the missing-grant case: from Oct 30 2026, new tables in the public schema on existing projects get no default grants for anon/authenticated, so a brand-new table can return 42501 before any policy is even evaluated. The safe fix is explicit per-role GRANTs (e.g. grant select, insert on public.projects to authenticated) plus enable row level security and the policies in the same migration, rather than disabling RLS or a bulk "grant all on all tables".
