timed out while waiting for target LSN n/n to be written; current s…

SQLSTATE 57014 condition query_canceled class 57 — Operator Intervention severity ERROR
Reproduced & verified on PostgreSQL 14.23, 15.18, 16.14, 17.10 and 18.4 — identical message on every version.
Last reviewed 2 Jun 2026 · Reproduced live with the SQL on this page.

Symptoms

A statement failed with SQLSTATE 57014 (query_canceled), reported at severity ERROR. This is a Operator Intervention condition: PostgreSQL emits the message timed out while waiting for target LSN n/n to be written; current standby_write LSN n/n.

What the server log shows

ERROR:  timed out while waiting for target LSN n/n to be written; current standby_write LSN n/n

Why PostgreSQL raises this

Class 57 (Operator Intervention) is raised when an administrator action or server lifecycle event interrupts the session — shutdown, cancellation, or a forced termination.

As described in PostgreSQL’s Section 19.6 Error Handling and Appendix A (PostgreSQL Error Codes), SQLSTATE 57014 carries the condition name query_canceled in class Operator Intervention. (Paraphrased — see the linked reference for the exact wording.)

Common causes

How to fix it

  1. Retry once the server is available again.
  2. Investigate why the backend was cancelled/terminated.
  3. Tune the relevant timeout if cancellations are unintended.

Version applicability

This message text is present in PostgreSQL 19. It was introduced around PostgreSQL 19; earlier releases do not emit this exact text.

Related & next steps

Reference: PostgreSQL Section 19.6 Error Handling.