Railway Postgres: Could Not Locate a Valid Checkpoint Record

Share
Ongoing PostgreSQL Updated November 14, 2026How we research

Quick answer

A damaged WAL leaves PostgreSQL unable to start. Prefer restoring a backup or point-in-time recovery; pg_resetwal is a last resort that can lose data.

Most likely fix: Restore instead of resetting

How to fix it

Try these in order — the most common fix is first.

  1. 1. Restore instead of resetting

    1. If point-in-time recovery is enabled, restore to a new service
    2. Otherwise restore a volume backup from the Backups tab
    Did this fix it?
  2. 2. Last resort: pg_resetwal

    1. Create a manual volume backup in the Backups tab
    2. Set Custom Start Command to 'sleep infinity' and deploy
    3. Run railway ssh and confirm PGDATA and matching Postgres major version
    4. Preview: su postgres -c "pg_resetwal --dry-run '$PGDATA'"
    5. Apply: su postgres -c "pg_resetwal --force '$PGDATA'"
    6. Remove sleep infinity, redeploy, then immediately dump the data and restore into a fresh Postgres service
    Did this fix it?

Symptoms

PostgreSQL fails to start; logs show 'FATAL: could not locate a valid checkpoint record' or 'invalid primary checkpoint record', sometimes at PANIC level.

Why it happens

  • Damaged WAL segment or control file, so no valid checkpoint exists to recover from

This guide also covers

  • railway postgres could not locate a valid checkpoint record
  • railway postgres won't start
  • railway database crashed

Still not working?

If Railway keeps failing, you're not alone. See every Railway problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us
Fixed it? Share this guide

Other Railway errors

All 10 Railway errors and fixes →