SQLSTATE F0001 FATAL Class F0: Config File Error

lock_file_exists lock file “postmaster.pid” already exists — F0001

PostgreSQL error “lock file “postmaster.pid” already exists — F0001″ (SQLSTATE F0001): what it means, common causes, and how to fix it.

PG 9.6, 10, 11, 12, 13, 14, 15, 16, 17, 18 Official docs
Last reviewed Jun 2026 Grounded in source

Diagnostic Queries

Symptoms

The server could not start (or create a resource) because a lock file already exists, suggesting another instance may be running. PostgreSQL raises SQLSTATE F0001 (lock_file_exists).

  • A postmaster.pid/lock file is already present.
  • Common when a previous instance didn’t shut down cleanly.
  • Prevents two postmasters on the same data directory.

What the server log shows

FATAL:  lock file "postmaster.pid" already exists
HINT:  Is another postmaster (PID 4242) running in data directory "/var/lib/pgsql/data"?

Why PostgreSQL raises this — what the manual says

Section 18.3 Starting the Database Server:

“While the server is running, its PID is stored in the file postmaster.pid in the data directory.”

PostgreSQL writes postmaster.pid to guard a data directory against concurrent postmasters. If the file exists at startup, it assumes another instance may be running and refuses to start, reporting F0001.

Common causes

  • Another PostgreSQL instance is already running on this data directory.
  • A crash left a stale postmaster.pid.
  • Manual mismanagement of the data directory.

How to fix it

  1. Confirm no live postmaster is running (check the PID in the hint).
  2. If truly stale (no running process), remove postmaster.pid and start again.
  3. Never delete the lock file while a server is actually running.

Related & next steps

Reference: PostgreSQL 18 Section 19.3 “Starting the Server”.

Was this helpful?