FATAL: terminating connection due to administrator command
srax
PROOP

8 months ago

"

2025-06-24 09:14:48.535 UTC [18763] FATAL: terminating connection due to administrator command

2025-06-24 09:14:48.641 UTC [26] LOG: checkpoint starting: immediate force wait

2025-06-24 09:14:48.675 UTC [26] LOG: checkpoint complete: wrote 1 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.003 s, sync=0.005 s, total=0.034 s; sync files=1, longest=0.005 s, average=0.005 s; distance=1 kB, estimate=34 kB; lsn=0/5C3F3E8, redo lsn=0/5C3F3B0

2025-06-24 09:14:50.151 UTC [19025] FATAL: database "railway" does not exist

2025-06-24 09:14:50.178 UTC [19026] FATAL: database "railway" does not exist
"

Hey guys everything was going smooth and suddenyl the DB connection was gone and it shows this in the logs.

$10 Bounty

14 Replies

srax
PROOP

8 months ago

d32e57bf-5b8c-49da-b920-3468725e35bb


srax
PROOP

8 months ago

Guys can i get some help with this issue above?


mycodej
HOBBY

8 months ago

Hi, I hope this can help you:

The line

FATAL: terminating connection due to administrator command

usually means your Postgres server was restarted or shut down—either manually, by your provider, or during a maintenance window. That forced all active connections (including yours) to close.

Then right after, you’re seeing:

FATAL: database "railway" does not exist

That means when your app tried to reconnect after the restart, it pointed to a database named railway, but that database wasn't there anymore.

Here's what I'd suggest:

  1. Check if the DB really is gone
    Try connecting to the default postgres database and list all available ones:

    psql "host=... user=... dbname=postgres" -c "\l"
    

    If railway isn't listed, then yeah, it got deleted or never existed in the first place.

  2. Restore or recreate it

    • If you have a backup/dump, you can create a new railway database and restore from that:

      createdb -h ... -U ... railway
      pg_restore -h ... -U ... -d railway path/to/backup.dump
      
    • If this was a new project and you never had data, just recreate the database and rerun your migrations or schema setup.

  3. Double-check your connection string
    Make sure your DATABASE_URL or config is pointing to the right DB name (e.g., .../railway). If the DB name changed or wasn’t recreated, it’ll keep throwing that error.

Going forward

  • If you're using a managed service (like Railway), check the dashboard or logs around the time it happened—there might’ve been a scheduled restart or resource limit hit.

  • And definitely set up automated backups if you haven’t already—just in case this ever happens again.

Hope this helps! Let me know if you want help checking anything specific.


srax
PROOP

8 months ago

fam


srax
PROOP

8 months ago

anyone?


passos
MODERATOR

8 months ago

hey, can you give us more information? were your database migrated by Railway? the message is basically saying that an application tried to access the "railway" database but it doesn't exist anymore.


srax
PROOP

8 months ago

Hi there—thanks for helping us troubleshoot. We handle migrations ourselves with TypeORM in our NestJS app, so Railway’s built-in migration service is disabled. On 16 June we cloned the project to create a staging environment; that action spun up a new Postgres plugin at monorail.proxy.rlwy.net:35676 with a fresh cluster, and our production DATABASE_URL was inadvertently overwritten to point to it. We never ran DROP DATABASE, removed the plugin, or invoked railway plugin delete in CI. Could you please review the activity/audit log for any service deletions or environment promotions around 2025-06-16 11:25 UTC (the timestamp of the first “starting PostgreSQL 16.8…” message), confirm whether the original Postgres plugin containing our historical data was deleted or now resides in another environment, and—if it was deleted—let us know whether a snapshot from before 16 June is available so we can restore it? We can provide the project and service IDs if that helps. Appreciate the assistance!


passos
MODERATOR

8 months ago

Hey, by migration I mean the [Metal]() migration and not database migrations, Railway does not offer any database migration service. If you duplicated your production environment (projects and environments are different) it shouldn't cause any issues with your current production environment, I would recommend looking at audit logs that are provided to users on the activity tab

1388639935493574700
1388639935795560400


srax
PROOP

8 months ago

yeah i remember having the metal migration and it happened automatically


srax
PROOP

8 months ago

ima look into


srax
PROOP

8 months ago

it


passos
MODERATOR

8 months ago

Great, then Railway didn't cause any issues. I would look into the audit logs as suggested.


srax
PROOP

8 months ago

thank you


srax
PROOP

8 months ago

got it


Loading...