{"id":"19eb71457311faec","repo":"jackc/pgx","slug":"require-auth-method-q-cannot-be-mixed-with-negati","errorCode":null,"errorMessage":"require_auth method %q cannot be mixed with negative methods","messagePattern":"require_auth method %q cannot be mixed with negative methods","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgconn/require_auth.go","lineNumber":102,"sourceCode":"\t\tneg := strings.HasPrefix(method, \"!\")\n\t\tif neg {\n\t\t\tmethod = method[1:]\n\t\t}\n\t\tif first {\n\t\t\tnegated = neg\n\t\t\tif negated {\n\t\t\t\t// A negated list starts from \"everything allowed, auth not required\" and removes\n\t\t\t\t// methods; \"!none\" below flips authRequired back on.\n\t\t\t\tra.allowed = 1<<authMethodCount - 1\n\t\t\t} else {\n\t\t\t\tra.authRequired = true\n\t\t\t}\n\t\t\tfirst = false\n\t\t} else if neg != negated {\n\t\t\tif neg {\n\t\t\t\treturn requireAuth{}, fmt.Errorf(\"negative require_auth method %q cannot be mixed with non-negative methods\", method)\n\t\t\t}\n\t\t\treturn requireAuth{}, fmt.Errorf(\"require_auth method %q cannot be mixed with negative methods\", method)\n\t\t}\n\n\t\tvar m authMethod\n\t\tswitch method {\n\t\tcase \"password\":\n\t\t\tm = authMethodPassword\n\t\tcase \"md5\":\n\t\t\tm = authMethodMD5\n\t\tcase \"gss\":\n\t\t\tm = authMethodGSS\n\t\tcase \"sspi\":\n\t\t\tm = authMethodSSPI\n\t\tcase \"scram-sha-256\":\n\t\t\tm = authMethodSCRAMSHA256\n\t\tcase \"oauth\":\n\t\t\tm = authMethodOAuth\n\t\tcase \"none\":\n\t\t\tm = authMethodNone","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgconn/require_auth.go#L84-L120","documentation":"Error \"require_auth method %q cannot be mixed with negative methods\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgconn/require_auth.go:102 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}