{"record":{"id":"2ae36a1aba91cbe0","repo":"jackc/pgx","slug":"expected-authenticationsaslcontinue-message-but-re","errorCode":null,"errorMessage":"expected AuthenticationSASLContinue message but received unexpected message %T","messagePattern":"expected AuthenticationSASLContinue message but received unexpected message %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgconn/auth_scram.go","lineNumber":126,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\treturn sc.recvServerFinalMessage(saslFinal.Data)\n}\n\nfunc (c *PgConn) rxSASLContinue() (*pgproto3.AuthenticationSASLContinue, error) {\n\tmsg, err := c.receiveMessage()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tswitch m := msg.(type) {\n\tcase *pgproto3.AuthenticationSASLContinue:\n\t\treturn m, nil\n\tcase *pgproto3.ErrorResponse:\n\t\treturn nil, ErrorResponseToPgError(m)\n\t}\n\n\treturn nil, fmt.Errorf(\"expected AuthenticationSASLContinue message but received unexpected message %T\", msg)\n}\n\nfunc (c *PgConn) rxSASLFinal() (*pgproto3.AuthenticationSASLFinal, error) {\n\tmsg, err := c.receiveMessage()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tswitch m := msg.(type) {\n\tcase *pgproto3.AuthenticationSASLFinal:\n\t\treturn m, nil\n\tcase *pgproto3.ErrorResponse:\n\t\treturn nil, ErrorResponseToPgError(m)\n\t}\n\n\treturn nil, fmt.Errorf(\"expected AuthenticationSASLFinal message but received unexpected message %T\", msg)\n}\n\ntype scramClient struct {","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgconn/auth_scram.go#L108-L144","documentation":"During SCRAM authentication the client expected an AuthenticationSASLContinue message (the server-first-message) but received a different backend message type. This means the server deviated from the SASL exchange sequence; authentication cannot continue.","triggerScenarios":"Thrown at pgconn/auth_scram.go:126 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the %T in the error to see what message arrived instead","Verify the server supports SCRAM-SHA-256 authentication","Ensure no middleware/proxy is mangling the protocol stream","Capture a trace of the authentication exchange for diagnosis"],"exampleFix":null,"handlingStrategy":"type-guard","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"}