{"record":{"id":"09d5cfd94728bccf","repo":"jackc/pgx","slug":"negative-require-auth-method-q-cannot-be-mixed-wi","errorCode":null,"errorMessage":"negative require_auth method %q cannot be mixed with non-negative methods","messagePattern":"negative require_auth method %q cannot be mixed with non-negative methods","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgconn/require_auth.go","lineNumber":100,"sourceCode":"\t\tmethod := strings.TrimSpace(part)\n\n\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","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgconn/require_auth.go#L82-L118","documentation":"The require_auth parameter mixed negated methods (prefixed with !) with non-negated ones, starting with non-negated. This is a configuration syntax error; the list must be all positive or all negated.","triggerScenarios":"Thrown at pgconn/require_auth.go:100 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use either all negated or all non-negated methods in require_auth","Start the list with ! if using negation semantics","Example: require_auth=!md5,!password to exclude methods"],"exampleFix":null,"handlingStrategy":"validation","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"}