jackc/pgx · error
unknown message type: %c
Error message
unknown message type: %c
What it means
The frontend received a message from the server with a type byte not defined in the PostgreSQL protocol. The %c shows the unknown type character. Likely a non-PostgreSQL server or corrupted stream.
Solutions
- Confirm you are connecting to a PostgreSQL server
- Check port number — connecting to a non-PostgreSQL service produces this
- Inspect for middleboxes altering traffic
- Reconnect to rule out transient corruption
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at pgproto3/frontend.go:394 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: /api/errors/f223bd7013bcb100.
Report an issue: GitHub.
Appendix: source
Thrown at pgproto3/frontend.go:394
}
case 's':
msg = &f.portalSuspended
case 'S':
msg = &f.parameterStatus
case 't':
msg = &f.parameterDescription
case 'T':
msg = &f.rowDescription
case 'V':
msg = &f.functionCallResponse
case 'W':
msg = &f.copyBothResponse
case 'Z':
msg = &f.readyForQuery
case 'v':
msg = &f.negotiateProtocolVersion
default:
return nil, fmt.Errorf("unknown message type: %c", f.msgType)
}
err = msg.Decode(msgBody)
if err != nil {
return nil, err
}
if f.tracer != nil {
f.tracer.traceMessage('B', int32(5+len(msgBody)), msg)
}
return msg, nil
}
// Authentication message type constants.
// See src/include/libpq/pqcomm.h for all
// constants.
const (View on GitHub (pinned to ec1a0befd2)