{"id":"dba11e99426cb584","repo":"jackc/pgx","slug":"ssl-request-too-short","errorCode":null,"errorMessage":"ssl request too short","messagePattern":"ssl request too short","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgproto3/ssl_request.go","lineNumber":20,"sourceCode":"\nimport (\n\t\"encoding/binary\"\n\t\"encoding/json\"\n\t\"errors\"\n\n\t\"github.com/jackc/pgx/v5/internal/pgio\"\n)\n\nconst sslRequestNumber = 80877103\n\ntype SSLRequest struct{}\n\n// Frontend identifies this message as sendable by a PostgreSQL frontend.\nfunc (*SSLRequest) Frontend() {}\n\nfunc (dst *SSLRequest) Decode(src []byte) error {\n\tif len(src) < 4 {\n\t\treturn errors.New(\"ssl request too short\")\n\t}\n\n\trequestCode := binary.BigEndian.Uint32(src)\n\n\tif requestCode != sslRequestNumber {\n\t\treturn errors.New(\"bad ssl request code\")\n\t}\n\n\treturn nil\n}\n\n// Encode encodes src into dst. dst will include the 4 byte message length.\nfunc (src *SSLRequest) Encode(dst []byte) ([]byte, error) {\n\tdst = pgio.AppendInt32(dst, 8)\n\tdst = pgio.AppendInt32(dst, sslRequestNumber)\n\treturn dst, nil\n}\n","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgproto3/ssl_request.go#L2-L38","documentation":"Error \"ssl request too short\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgproto3/ssl_request.go:20 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}