select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

SQLSTATE / CLASS 58 · SYSTEM ERROR (ERRORS EXTERNAL TO POSTGRESQL ITSELF)

io_error

SQLSTATE
58030
Condition name
io_error
Class
System Error (errors external to PostgreSQL itself)
Source macro
ERRCODE_IO_ERROR
Evidence
Source path confirmed
Analysis & operational context

English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗

<h1>58030</h1>

At a glance

58030 is emitted by a specific shared-buffer cleanup path after a write failure has already been recorded. In PostgreSQL 18.6 that path reports WARNING, not a generic client ERROR: it names the block and relation and says that repeated failure may be permanent.

Meaning

FlushBuffer starts the shared-buffer write, flushes WAL first for permanent relations, and calls smgrwrite. If error unwinding reaches the resource-owner buffer-I/O callback, AbortBufferIO marks the buffer with BM_IO_ERROR. When the buffer is still valid and dirty and this is not the first failure, it emits SQLSTATE 58030 at WARNING level, then terminates the buffer I/O with the error flag. The earlier smgrwrite failure is the event that may have aborted the client statement; this later warning is a repeat-failure notice and does not by itself establish that the client transaction is in error.

The relation text is generated from the buffer tag (relpathperm), while the write callback can add the context writing block %u of relation "%s" to the original error. The message therefore identifies where to investigate, but it is not a promise that the block is the only damaged object.

A separate storage-manager path extends a relation segment with FileWrite. If that call returns a negative result, md.c raises ERROR with could not extend file "%s": %m and errcode_for_file_access(); the saved EIO errno maps to 58030, while ENOSPC maps to 53100. This original ERROR can abort a client statement and put an explicit transaction in the failed state. It is a different emission from the later repeated-failure WARNING in AbortBufferIO.

Messages

  • WARNING, SQLSTATE 58030: could not write block %u of %s
  • Detail: Multiple failures --- write error might be permanent.
  • Error context used around shared-buffer writes: writing block %u of relation "%s".
  • ERROR, SQLSTATE selected by errcode_for_file_access(); for saved EIO, 58030: could not extend file "%s": %m
  • Hint: Check free disk space.

The first write failure can have a different primary message and SQLSTATE, for example one selected by an OS errno helper. Preserve that first record together with this warning. In the relation-extension path, EIO deliberately selects this condition, whereas ENOSPC selects 53100; do not collapse those errno branches into a generic disk-full diagnosis.

Diagnosis

Keep the complete error chain, including the first write error, this warning, server-log context, relation fork and block, filesystem or device errno, mount state, and whether WAL or a replica has confirmed the write. Check whether the failing operation was a backend statement, checkpoint, background writer, or another server path. A source-only review cannot identify which storage component failed on a particular deployment.

Response

Stop retrying while the storage path is unhealthy. Verify the mount, device, permissions, space and quota, and storage error logs; preserve the affected relation and replica evidence before any repair. The relation-extension ERROR can leave an explicit client transaction failed, so issue ROLLBACK or ROLLBACK TO an already-established savepoint before sending more SQL. The repeated-failure WARNING from a background or cleanup path does not by itself require a client rollback, but it still requires storage remediation and a durability check. Retry the whole idempotent unit only after the cause is fixed; if the backend or server stopped, use a new connection and validate commit state before replaying work.

Versions

The locked catalogue records this condition from 7.4; the fixed mechanism and message role are read from PostgreSQL 18.6. No natural I/O failure was induced for this source-only entry.

Sources

src/backend/storage/buffer/bufmgr.c#L4307-L4436

src/backend/storage/buffer/bufmgr.c#L6164-L6225

src/backend/storage/smgr/md.c#L512-L519

src/backend/utils/error/elog.c#L867-L942

The structured evidence record records the fixed warning, detail, source boundary, and lack of natural runtime evidence.

Source evidence

Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.

58030 is io_error in SQLSTATE Class 58.

Method: Read locked definition snapshot.

src.errcodes.18.6

FlushBuffer writes a shared buffer through smgrwrite, and AbortBufferIO emits the fixed 58030 warning only after a prior I/O error is present on a valid dirty buffer.

Method: Read the complete fixed write and error-unwind contexts.

Limits: Source confirmation is not natural runtime.

src.path.0 src.path.1

The relation-extension FileWrite path emits ERROR with a %m primary and errcode_for_file_access(); saved EIO maps to 58030 and saved ENOSPC maps to 53100.

Method: Read the complete negative-write branch and the saved-errno switch.

Limits: The source establishes message roles and code mapping, not a natural I/O failure on a host.

src.path.2 src.path.3

The locked catalogue records 58030 from 7.4; it does not prove the exact introduction or every historical emitter.

Method: Use locked catalogue boundary.

src.errcodes.18.6

Message templates

WARNING · message.0

Primary

could not write block %u of %s

Detail

Multiple failures --- write error might be permanent.

Context

writing block %u of relation "%s"
ERROR · message.1

Primary

could not extend file "%s": %m

Hint

Check free disk space.

Reproduction & repair cases

No reproduction case is attached to this condition.

Recorded runtime evidence

No runtime observation is attached to this entry.

Definition snapshot: english-manuals:f84907ac0fc17911cb1f02c1abc… · English manual source