{"id":"8c7944715991dff7","repo":"jackc/pgx","slug":"unexpected-message-type-during-oauth-auth-t","errorCode":null,"errorMessage":"unexpected message type during OAuth auth: %T","messagePattern":"unexpected message type during OAuth auth: %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgconn/auth_oauth.go","lineNumber":65,"sourceCode":"\t\terrResponse := struct {\n\t\t\tStatus              string `json:\"status\"`\n\t\t\tScope               string `json:\"scope\"`\n\t\t\tOpenIDConfiguration string `json:\"openid-configuration\"`\n\t\t}{}\n\t\terr := json.Unmarshal(m.Data, &errResponse)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid OAuth error response from server: %w\", err)\n\t\t}\n\n\t\t// Per RFC 7628 section 3.2.3, we should send a SASLResponse which only contains \\x01.\n\t\t// However, since the connection will be closed anyway, we can skip this\n\t\treturn fmt.Errorf(\"OAuth authentication failed: %s\", errResponse.Status)\n\n\tcase *pgproto3.ErrorResponse:\n\t\treturn ErrorResponseToPgError(m)\n\n\tdefault:\n\t\treturn fmt.Errorf(\"unexpected message type during OAuth auth: %T\", msg)\n\t}\n}\n","sourceCodeStart":47,"sourceCodeEnd":68,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgconn/auth_oauth.go#L47-L68","documentation":"Error \"unexpected message type during OAuth auth: %T\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgconn/auth_oauth.go:65 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}