SQLSTATE 58030 ERROR Class 58: System Error

io_error could not read block N in file “…”: read only 0 of N bytes — 58030

PostgreSQL error "could not read block N in file "…": read only 0 of N bytes" (SQLSTATE 58030): what it means, common causes, and how to fix it.

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

Diagnostic Queries

Symptoms

PostgreSQL tried to read a data block but the file was shorter than expected (it read 0 of the requested bytes). This usually signals truncation or storage failure and raises SQLSTATE 58030 (io_error).

  • The block PostgreSQL expects is beyond the end of the file.
  • Often a sign of filesystem damage, truncation, or hardware faults.
  • Reads of the affected relation fail.

What the server log shows

ERROR:  could not read block 8423 in file "base/16384/24576": read only 0 of 8192 bytes

Why PostgreSQL raises this — what the manual says

As Section 30.2 Data Checksums explains:

A read returned fewer bytes than the expected block size (zero of the requested bytes), indicating the relation file is truncated or the underlying storage failed to return the page; this points to filesystem or hardware-level corruption.

PostgreSQL expects each relation file to contain whole 8 kB blocks. When a requested block lies past the actual end of the file (read returns 0 bytes), it cannot proceed and reports 58030, indicating storage-level damage or truncation.

Common causes

  • Filesystem corruption or a truncated relation file.
  • Failing disk, bad sectors, or storage-layer faults.
  • An interrupted restore or a partially copied data directory.

How to fix it

  1. Stop and take a full backup of the data directory before anything else.
  2. Check OS/disk logs (SMART, dmesg) and the underlying storage health.
  3. Restore the affected relation/table from a known-good backup; consider PITR.

Related & next steps

Reference: PostgreSQL 18 Section 30.2 “Reliability”.

Was this helpful?