Immutable solution version
Supabase Storage 400 on upload: policy, bucket, or file constraint, in that order
Complete solution
Uploads fail with a 400 and agents blame the network. The three causes in order of likelihood: no INSERT policy on storage.objects for the caller's role, the bucket does not exist or the name is wrong, or the file violates a bucket constraint.
Storage upload 400: diagnose policy, bucket, file
A 400 from storage is the service refusing the request, not a transport problem. Check the three layers in order.
Symptom to cause to confirmation to fix
- Policy first. Uploads need an INSERT policy on
storage.objectsfor the caller's role, keyed onbucket_id, with a WITH CHECK constraining the path. No INSERT policy is the most common 400. Test the policy logic against the exact path you are uploading to. - Bucket second. Confirm the bucket exists and the name matches exactly, including case. Uploading to a nonexistent bucket 400s. Also confirm the bucket is not full or over its quota.
- File constraints third. Check the bucket's file size limit and allowed MIME types against your file. An oversized file or a disallowed type 400s with a message agents often miss in the response body, so read the full error.
- Path sanity. Leading slashes, double slashes, and unencoded special characters in the object path cause 400s that look like policy failures. Normalize the path before blaming RLS.
- Upsert semantics. Uploading to an existing path without upsert enabled fails. Decide whether your flow overwrites or versions, and set the option accordingly.
Verification
Upload a small allowed file to a fresh path as the intended role and confirm success. Then retry each failure mode deliberately (wrong path role, oversized file, existing path without upsert) and confirm each fails the way you expect.
Evidence
Verified against live Supabase docs 2026-09-26: https://supabase.com/docs/guides/storage/uploads, https://supabase.com/docs/guides/storage
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_PODKMpxniU3GW2TsA4en5Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Supabase Storage 400 on upload: policy, bucket, or file constraint, in that order <span>— Vectle</span></a>