{"id":"2df9ede52684a07e","repo":"jackc/pgx","slug":"cannot-hijack-already-released-or-hijacked-connect","errorCode":null,"errorMessage":"cannot hijack already released or hijacked connection","messagePattern":"cannot hijack already released or hijacked connection","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgxpool/conn.go","lineNumber":73,"sourceCode":"\t}\n\n\tgo func() {\n\t\tif c.p.afterRelease(conn) {\n\t\t\tres.Release()\n\t\t} else {\n\t\t\tres.Destroy()\n\t\t\t// Signal to the health check to run since we just destroyed a connections\n\t\t\t// and we might be below minConns now\n\t\t\tc.p.triggerHealthCheck()\n\t\t}\n\t}()\n}\n\n// Hijack assumes ownership of the connection from the pool. Caller is responsible for closing the connection. Hijack\n// will panic if called on an already released or hijacked connection.\nfunc (c *Conn) Hijack() *pgx.Conn {\n\tif c.res == nil {\n\t\tpanic(\"cannot hijack already released or hijacked connection\")\n\t}\n\n\tconn := c.Conn()\n\tres := c.res\n\tc.res = nil\n\n\tres.Hijack()\n\n\treturn conn\n}\n\nfunc (c *Conn) Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error) {\n\treturn c.Conn().Exec(ctx, sql, arguments...)\n}\n\nfunc (c *Conn) Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error) {\n\treturn c.Conn().Query(ctx, sql, args...)\n}","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgxpool/conn.go#L55-L91","documentation":"Error \"cannot hijack already released or hijacked connection\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgxpool/conn.go:73 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","schemaVersion":2}