timed out while waiting for target LSN n/n to be flushed; current p…
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 flushed; current primary_flush LSN n/n.
- The client receives SQLSTATE
57014(query canceled). - The operation is rejected at
ERRORlevel; the statement does not complete.
What the server log shows
ERROR: timed out while waiting for target LSN n/n to be flushed; current primary_flush 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
- The administrator cancelled the query or terminated the backend.
- The server is shutting down or in recovery.
- A statement or idle-in-transaction timeout fired.
How to fix it
- Retry once the server is available again.
- Investigate why the backend was cancelled/terminated.
- 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.