cli icon indicating copy to clipboard operation
cli copied to clipboard

🐛 Local Postgres container fails to start unless `.temp/postgres-version` is pinned

Open ChenYujunjks opened this issue 8 months ago • 1 comments

Bug description

When using supabase start locally, if .temp/postgres-version is not manually set, the CLI pulls the latest Postgres image (currently v17.4.x). This causes the Postgres container to fail startup, with errors in WAL recovery and a missing 99-roles.sql file. Eventually the container is marked as unhealthy.

Logs


LOG:  database system was interrupted; last known up at ...
LOG:  redo starts at ...
LOG:  invalid record length at ...: expected at least 24, got 0
psql: error: /docker-entrypoint-initdb.d/init-scripts/99-roles.sql: No such file or directory

Final CLI error:


supabase\_db\_<project> container is not ready: unhealthy


Steps to reproduce

  1. Create or clone a Supabase CLI project
  2. Run supabase start without creating .temp/postgres-version
  3. Observe that supabase_db_* fails to start
  4. See WAL recovery + init-script errors in logs

Expected behavior

Supabase CLI should default to a known stable Postgres version (e.g. 15.x) instead of latest, unless user explicitly opts into newer version.


Workaround

echo '17.4.1.010' > supabase/.temp/postgres-version
supabase stop
supabase start

This makes the container healthy and bypasses WAL/init errors.


Environment


Suggestion

Supabase CLI should:

  • Either pin a stable default Postgres version (like 15.x)
  • Or provide a clear warning when pulling latest may cause incompatibilities

ChenYujunjks avatar Jun 22 '25 16:06 ChenYujunjks

@ChenYujunjks

ChenYujunjks avatar Jun 22 '25 16:06 ChenYujunjks

This seems to be an issue with local db volume. Did you try supabase stop --no-backup before supabase start?

closing as duplicate https://github.com/supabase/cli/issues/3639

sweatybridge avatar Jul 16 '25 03:07 sweatybridge

This seems to be an issue with local db volume. Did you try supabase stop --no-backup before supabase start?

closing as duplicate #3639

I didn't. Last time I solved it by editing the echo '17.4.1.010' > supabase/.temp/postgres-version

But now is update supabase to 2.31.4 and it seems it no longer has this bug anymore

ChenYujunjks avatar Jul 16 '25 06:07 ChenYujunjks