cli icon indicating copy to clipboard operation
cli copied to clipboard

Supabase CLI fails to start locally due to missing `type` column in `buckets` table

Open HarrisConsulting opened this issue 1 year ago • 5 comments

Summary

Supabase CLI (v2.31.4 via Homebrew) fails to start the local development server due to a database error:

column "type" does not exist

in the buckets and buckets_analytics tables.
This occurs after fresh project initialization, full reset, and Docker image cleanup. The error blocks local development even without any custom storage or bucket migrations.


Steps to Reproduce

  1. Install Supabase CLI via Homebrew
    brew install supabase (v2.31.4)
  2. Initialize a new project:
    supabase init
  3. Create a simple migration (optional, e.g., single migration for a profiles table).
  4. Stop and remove all Supabase-related containers and images:
    supabase stop --no-backup
    rm -rf .supabase
    docker ps -a --filter "name=supabase" --format "{{.ID}}" | xargs -r docker rm -f
    docker images --filter=reference='supabase/*' --format '{{.Repository}}:{{.Tag}}' | xargs -r docker rmi -f
    
  5. Start Supabase locally:
    supabase start
  6. Observe the error output in the CLI.

Actual Error Output

Error status 500: {"statusCode":"500","code":"DatabaseError","error":"DatabaseError","message":"select * from ((select \"id\", \"name\", \"type\", \"public\", \"owner\", \"created_at\", \"updated_at\", \"file_size_limit\", \"allowed_mime_types\" from \"buckets\") union all (select \"id\", \"id\" as \"name\", \"type\", null as \"public\", null as \"owner\", \"created_at\", \"updated_at\", null as \"file_size_limit\", null as \"allowed_mime_types\" from \"buckets_analytics\")) as \"all_buckets\" - column \"type\" does not exist"}
  • The error is thrown by a background process in the CLI querying for storage buckets.
  • No custom code or migrations related to buckets/storage exist in the project.

Environment Details

  • OS: macOS (Darwin 24.5.0)
  • Supabase CLI version: 2.31.4 (Homebrew)
  • Docker: Latest, freshly pulled images
  • Project Schema: Only a single migration for a profiles table. No custom storage/buckets/analytics migrations.
  • Supabase config: [storage] enabled = true in supabase/config.toml. No custom bucket definitions.
  • No seed.sql present.

Troubleshooting Steps Taken

  • Stopped and removed all Supabase containers and volumes.
  • Deleted all Supabase Docker images.
  • Deleted .supabase directory to force clean initialization.
  • Upgraded Supabase CLI to the latest version.
  • Attempted manual schema patch (unable to connect as database doesn’t start).
  • Tried starting with and without migrations—error persists.

Diagnostics and Observations

  • The CLI’s internal query expects a type column in both buckets and buckets_analytics tables.
  • Local database schema does not include these columns after a fresh start/reset, suggesting a core schema or migration bug with CLI v2.31.x.
  • No custom SQL or migrations interfere with storage tables.
  • The error blocks local development entirely; cannot connect to DB to patch manually.
  • No currently open GitHub issue matches this exact error.

Expected Behavior

  • Supabase CLI should automatically initialize all required storage system tables and columns, including the type column, on a fresh local start/reset.
  • Local development should function out-of-the-box without manual schema intervention.

Impact

  • Unable to run Supabase locally for development or testing.
  • No workaround available, as system tables cannot be patched without a running database.
  • Project is blocked until bug is resolved.

Request

  • Please investigate and patch the CLI or Docker images to ensure the storage schema is fully initialized.
  • If a manual workaround is available (e.g., SQL to patch the schema before startup), please provide detailed instructions.
  • Advise if a specific CLI or Docker image version is required for local development compatibility.

Thank you for addressing this blocker!

HarrisConsulting avatar Jul 17 '25 19:07 HarrisConsulting

Experiencing the same thing. I solved it by turning storage off in config.toml for now but locally that is a real pain.

joelpierre avatar Jul 17 '25 22:07 joelpierre

+1

ArturOPaes avatar Jul 17 '25 22:07 ArturOPaes

Same here. Supabase SDK 2.31.4 installed by homebrew, tried remove docker and everything but not helped. Turning storage off in config.toml for now.

iamcxa avatar Jul 18 '25 06:07 iamcxa

this looks like a duplicate of https://github.com/supabase/cli/issues/3863#issuecomment-3077276245

I've released a fix to beta channel.

npx supabase@beta start

sweatybridge avatar Jul 18 '25 07:07 sweatybridge

Wow, this just costed me 6 hours of debugging. Thanks, Supabase.

star26bsd avatar Jul 20 '25 15:07 star26bsd