jackc/pgx · error

pipeline closed

Error message

pipeline closed

What it means

Error "pipeline closed" thrown in jackc/pgx.

Source

Thrown at pgconn/pgconn.go:2568

//
// Note that the request is not itself flushed to the server automatically; use Flush if
// necessary. This copies the behavior of libpq PQsendPipelineSync.
func (p *Pipeline) SendPipelineSync() {
	if p.closed {
		return
	}

	p.conn.frontend.SendSync(&pgproto3.Sync{})
	p.state.PushBackRequestType(pipelineSyncRequest)
}

// Flush flushes the queued requests without establishing a synchronization point.
func (p *Pipeline) Flush() error {
	if p.closed {
		if p.err != nil {
			return p.err
		}
		return errors.New("pipeline closed")
	}

	err := p.conn.flushWithPotentialWriteReadDeadlock()
	if err != nil {
		err = normalizeTimeoutError(p.ctx, err)

		p.conn.asyncClose()

		p.conn.contextWatcher.Unwatch()
		p.conn.unlock()
		p.closed = true
		p.err = err
		return err
	}

	p.state.RegisterSendingToServer()
	return nil
}

View on GitHub (pinned to ec1a0befd2)

When it happens

Trigger: Thrown at pgconn/pgconn.go:2568 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of jackc/pgx@ec1a0befd2 (2026-08-04). Data as JSON: /data/errors/f385572b141af73c.json. Report an issue: GitHub.