cli icon indicating copy to clipboard operation
cli copied to clipboard

Cannot start supabase after stopping

Open leesus opened this issue 3 years ago • 2 comments

Bug report

Describe the bug

After stopping local supabase with Ctrl+C, subsequent supabase start calls fail with the error: Error starting database: ERROR: database "main" does not exist.

There is a SQL dump inside supabase/.branches/main directory.

I then have to nuke my supabase directory, then re-init.

To Reproduce

  1. supabase init
  2. supabase start
  3. Ctrl+C once instance is up
  4. supabase start
  5. See error

Expected behavior

supabase start restarts the instance once stopped.

System information

  • OS: macOS
  • Version of supabase-js: 0.15.14
  • Version of Node.js: 14.18.1

Additional context

Fairly new to the Go CLI, I was using the old Docker setup without incident, so possibly I'm missing something simple.

leesus avatar Jan 06 '22 15:01 leesus

Sorry for the late reply! Can you see if the latest version (v0.16.1) fixes this? Issues related to branching should be curbed a bit. The new repro steps would be:

  1. supabase init
  2. supabase start
  3. supabase stop
  4. supabase start

soedirgo avatar Jan 19 '22 19:01 soedirgo

I also had this same issue. It seems to be running now after upgrading to the latest (0.17.2 as of writing).

zeenotheinventor avatar Feb 09 '22 16:02 zeenotheinventor

Closing this issue since the containers are started in background in cli v1.

sweatybridge avatar Aug 17 '22 10:08 sweatybridge

This issue still regresses with cli v1.33.0.

Steps to reproduce:

  1. supabase init
  2. supabase start
  3. Used the studio to create a schema and a table
  4. supabase stop
  5. supabase start --debug

Error ("Error restoring main: branch was not dumped")

file attached

its obviously related to the .branch directory - when I delete the .branch it starts up fine, but I lose all the state and start from scratch.

error.txt

nextgenmetrics avatar Jan 15 '23 14:01 nextgenmetrics

@leesus this is probably just a misleading log statement. Can you check supabase status after start to see if the db is actually running?

sweatybridge avatar Jan 15 '23 15:01 sweatybridge

the containers are all terminated. so status returns an error.

…/supabase/projects/pragma/supabase  supabase status

Error: Error: No such container: supabase_db_pragma Try rerunning the command with --debug to troubleshoot the error.

nextgenmetrics avatar Jan 15 '23 16:01 nextgenmetrics

after the start, still errors

…/supabase/projects/pragma/supabase  supabase start Error restoring main: branch was not dumped. Error: unlinkat supabase/.branches/main: operation not permitted Try rerunning the command with --debug to troubleshoot the error.

nextgenmetrics avatar Jan 15 '23 16:01 nextgenmetrics

Error: unlinkat supabase/.branches/main: operation not permitted

This is a problem with local directory permission. Have you modified this before with chown/chmod? A quick fix is to delete .branches/main

sweatybridge avatar Jan 15 '23 23:01 sweatybridge

Getting the same error on every start even if i delete the .branches/main folder, but i dont have a db dump in that folder. The supabase status returns no errors, i also dont get the unlinkat error, just the Error restoring main: branch was not dumped. I guess it is not able to do a sql dump in that folder? Using 1.34.5

espensgr avatar Jan 27 '23 09:01 espensgr

same error

fRankete107 avatar May 08 '23 05:05 fRankete107