Railway Postgres: Could Not Locate a Valid Checkpoint Record
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. Restore instead of resetting
- If point-in-time recovery is enabled, restore to a new service
- Otherwise restore a volume backup from the Backups tab
Did this fix it?2. Last resort: pg_resetwal
- Create a manual volume backup in the Backups tab
- Set Custom Start Command to 'sleep infinity' and deploy
- Run railway ssh and confirm PGDATA and matching Postgres major version
- Preview: su postgres -c "pg_resetwal --dry-run '$PGDATA'"
- Apply: su postgres -c "pg_resetwal --force '$PGDATA'"
- 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 usOther Railway errors
- Railway Application Failed to Respond (502)
- Railway: No Start Command Could Be Found
- Railway Slow Deployments and Slow App
- Railway Node.js SIGTERM Handler Not Running
- Railway ENOTFOUND redis.railway.internal
- Railway SSL Certificate Stuck or Not Working (526, 525, Too Many Redirects)
- Railway 405 Method Not Allowed on POST Requests
- Railway Services Stopped: Trial Credits Ran Out