{"record":{"id":"f385572b141af73c","repo":"jackc/pgx","slug":"pipeline-closed","errorCode":null,"errorMessage":"pipeline closed","messagePattern":"pipeline closed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgconn/pgconn.go","lineNumber":2568,"sourceCode":"//\n// Note that the request is not itself flushed to the server automatically; use Flush if\n// necessary. This copies the behavior of libpq PQsendPipelineSync.\nfunc (p *Pipeline) SendPipelineSync() {\n\tif p.closed {\n\t\treturn\n\t}\n\n\tp.conn.frontend.SendSync(&pgproto3.Sync{})\n\tp.state.PushBackRequestType(pipelineSyncRequest)\n}\n\n// Flush flushes the queued requests without establishing a synchronization point.\nfunc (p *Pipeline) Flush() error {\n\tif p.closed {\n\t\tif p.err != nil {\n\t\t\treturn p.err\n\t\t}\n\t\treturn errors.New(\"pipeline closed\")\n\t}\n\n\terr := p.conn.flushWithPotentialWriteReadDeadlock()\n\tif err != nil {\n\t\terr = normalizeTimeoutError(p.ctx, err)\n\n\t\tp.conn.asyncClose()\n\n\t\tp.conn.contextWatcher.Unwatch()\n\t\tp.conn.unlock()\n\t\tp.closed = true\n\t\tp.err = err\n\t\treturn err\n\t}\n\n\tp.state.RegisterSendingToServer()\n\treturn nil\n}","sourceCodeStart":2550,"sourceCodeEnd":2586,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgconn/pgconn.go#L2550-L2586","documentation":"Pipeline.Flush guard: the pipeline has already been closed (via Close or a prior error), so queued requests can no longer be flushed to the server. If the pipeline was closed because of an earlier failure, p.err is returned instead; this literal is only used when Close succeeded cleanly.","triggerScenarios":"Thrown at pgconn/pgconn.go:2568 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not call Flush after Close; check the pipeline's lifecycle in calling code","Structure pipeline usage so results are fully consumed before closing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}