{"id":"cf2140998422828b","repo":"jackc/pgx","slug":"syncconn-conn-never-synchronized","errorCode":null,"errorMessage":"SyncConn: conn never synchronized","messagePattern":"SyncConn: conn never synchronized","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgconn/pgconn.go","lineNumber":2169,"sourceCode":"// require sending a ping to the server. ctx can be used to cancel this operation. This should be called before any\n// operation that will use the underlying net.Conn directly. e.g. Before Conn() or Hijack().\n//\n// This should not be confused with the PostgreSQL protocol Sync message.\nfunc (pgConn *PgConn) SyncConn(ctx context.Context) error {\n\tfor range 10 {\n\t\tif pgConn.bgReader.Status() == bgreader.StatusStopped && pgConn.frontend.ReadBufferLen() == 0 {\n\t\t\treturn nil\n\t\t}\n\n\t\terr := pgConn.Ping(ctx)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"SyncConn: Ping failed while syncing conn: %w\", err)\n\t\t}\n\t}\n\n\t// This should never happen. Only way I can imagine this occurring is if the server is constantly sending data such as\n\t// LISTEN/NOTIFY or log notifications such that we never can get an empty buffer.\n\treturn errors.New(\"SyncConn: conn never synchronized\")\n}\n\n// CustomData returns a map that can be used to associate custom data with the connection.\nfunc (pgConn *PgConn) CustomData() map[string]any {\n\treturn pgConn.customData\n}\n\n// HijackedConn is the result of hijacking a connection.\n//\n// Due to the necessary exposure of internal implementation details, it is not covered by the semantic versioning\n// compatibility.\ntype HijackedConn struct {\n\tConn              net.Conn\n\tTLSConfig         *tls.Config       // tls.Config that Conn was negotiated with; nil if Conn is not TLS\n\tPID               uint32            // backend pid\n\tSecretKey         []byte            // key to use to send a cancel query message to the server\n\tParameterStatuses map[string]string // parameters that have been reported by the server\n\tTxStatus          byte","sourceCodeStart":2151,"sourceCodeEnd":2187,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgconn/pgconn.go#L2151-L2187","documentation":"Error \"SyncConn: conn never synchronized\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgconn/pgconn.go:2169 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}