cli icon indicating copy to clipboard operation
cli copied to clipboard

"error running container: exit 1" when restoring database backups in local development

Open nilsreichardt opened this issue 8 months ago • 2 comments

Bug report

  • [x] I confirm this is a bug with Supabase, not with my own application.
  • [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

When I execute supabase db start --from-backup db_cluster.backup, I get the following error:

$ supabase db start --from-backup db_cluster-04-05-2025\@01-08-27.backup --debug
Supabase CLI 2.22.6
Starting database...
+ ulimit -n
+ '[' '!' -z '' ']'
+ export ERL_CRASH_DUMP=/tmp/erl_crash.dump
+ ERL_CRASH_DUMP=/tmp/erl_crash.dump
+ '[' false = true ']'
+ echo 'Running migrations'
+ sudo -E -u nobody /app/bin/migrate
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 14991ms. This means requests are coming in and your connection pool cannot serve them fast enough. You can address this by:

  1. Ensuring your database is available and that you can connect to it
  2. Tracking down slow queries and making sure they are running fast enough
  3. Increasing the pool_size (although this increases resource consumption)
  4. Allowing requests to wait longer by increasing :queue_target and :queue_interval

See DBConnection.start_link/2 for more information

    (ecto_sql 3.11.3) lib/ecto/adapters/sql.ex:1054: Ecto.Adapters.SQL.raise_sql_call_error/1
    (elixir 1.17.3) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
    (ecto_sql 3.11.3) lib/ecto/adapters/sql.ex:1161: Ecto.Adapters.SQL.execute_ddl/4
    (ecto_sql 3.11.3) lib/ecto/migrator.ex:755: Ecto.Migrator.verbose_schema_migration/3
    (ecto_sql 3.11.3) lib/ecto/migrator.ex:563: Ecto.Migrator.lock_for_migrations/4
    (ecto_sql 3.11.3) lib/ecto/migrator.ex:432: Ecto.Migrator.run/4
    (ecto_sql 3.11.3) lib/ecto/migrator.ex:170: Ecto.Migrator.with_repo/3
    nofile:1: (file)
Stopping containers...
Pruned containers: [24e7384f9c3dc72e7b7c02e3af4e2f3fa83d88cba9f41b36b0e38f2e85ab77bf]
Pruned volumes: [supabase_db_temp-supabase supabase_config_temp-supabase]
Pruned network: [supabase_network_temp-supabase]
error running container: exit 1

To Reproduce

  1. Download a backup from hosted Supabase backup
  2. Unzip the backup
  3. Follow steps from https://supabase.com/docs/guides/local-development/restoring-downloaded-backup#restoring-your-backup
  4. See error

https://github.com/user-attachments/assets/827f8ad1-8b6d-4f8c-97dd-30970da087a1

Expected behavior

No errors.

Screenshots

Image

System information

  • OS: macOS
  • Version of Supabase CLI: 2.22.6
  • Postgres version: 15.6.1.115

nilsreichardt avatar May 04 '25 16:05 nilsreichardt

Moved over from the supabase repo.

Hallidayo avatar May 06 '25 08:05 Hallidayo

facing same issues.

nitinhayaran avatar Jun 20 '25 02:06 nitinhayaran

Could you share the project ref? I need to take a closer look on the backup file.

sweatybridge avatar Oct 22 '25 12:10 sweatybridge

No project ref needed, you should get this error with any .backup file, even if the file is empty.

nilsreichardt avatar Oct 22 '25 17:10 nilsreichardt

hello, i also had a (DBConnection.ConnectionError) on supabase start, in my case it was the wrong docker context.

fusifusi avatar Oct 22 '25 18:10 fusifusi

The error actually comes from realtime container failing to boot. In the latest cli, we actually skip the service containers when restoring from backup. So the first thing you need to try is to use the latest cli.

npx supabase@latest db start --from-backup ...

Secondly, realtime container failing to start is usually a red herring for other failures when restoring the backup file. So if the latest cli doesn't work, please send me your project ref so I can take a closer look on a case by case basis.

sweatybridge avatar Oct 22 '25 18:10 sweatybridge