SQLSTATE 58P01 ERROR Class 58: System Error

undefined_file Undefined File — SQLSTATE 58P01

SQLSTATE 58P01 (undefined_file): An operating-system level error occurred (I/O or missing file).

PG 12, 13, 14, 15, 16, 17, 18 Official docs
Last reviewed May 2025 Grounded in source

Symptoms

The server reports SQLSTATE 58P01 (undefined_file), a condition in the System Error class.

  • The error is written to the server log and returned to the client carrying SQLSTATE 58P01.
  • Any driver (libpq, JDBC, psycopg, npgsql, pgx) surfaces this code in its error object so you can branch on it programmatically.
  • PL/pgSQL can trap it by name: EXCEPTION WHEN undefined_file THEN.

Environment

Severity: ERROR  |  PostgreSQL versions: 12, 13, 14, 15, 16, 17

Indicates a system- or storage-level problem; inspect OS logs, disk health, and any recent hardware or filesystem changes.

Root Cause

58P01 belongs to Class 58 — System Error. In this class, an operating-system level error occurred (I/O or missing file).

The first two characters (58) identify the error class, so application code can match the whole class via 58000 when the specific code is not needed.

Diagnostic Queries

Recovery

Check disk health (SMART), filesystem integrity, data-directory permissions, and free space; inspect OS logs and stop running on failing hardware — restore from backup if files are damaged.

Reference: PostgreSQL error codes — Class 58 (System Error).

Was this helpful?