Diagnostic Queries
Symptoms
PostgreSQL tried to open a file it expected to exist (a relation segment, WAL file, or other server file) but the OS reported it missing. This raises SQLSTATE 58P01 (undefined_file).
- A file the catalog references is absent on disk.
- Can indicate corruption, manual file deletion, or restore problems.
- The named path tells you what was expected.
What the server log shows
ERROR: could not open file "base/16384/24576": No such file or directory
Why PostgreSQL raises this — what the manual says
Section 66.1 Database File Layout:
“Each table and index is stored in a separate file.”
System catalogs map relations to files on disk. When PostgreSQL needs a file that the catalog references but the OS cannot find it, it cannot read the data and reports 58P01.
Common causes
- Files manually deleted/moved from the data directory.
- An incomplete or inconsistent restore/copy.
- Filesystem corruption or a missing tablespace mount.
How to fix it
- Ensure all tablespace mounts/paths are present and mounted.
- Never manually modify the data directory; restore from a consistent backup.
- Verify the restore copied every file; re-run from a known-good backup if not.
Related & next steps
Reference: PostgreSQL 18 Section 76.1 “Database File Layout”.
Thanks — noted. This helps keep the database accurate.