jackc/pgx · error
require_auth method %q cannot be mixed with negative methods
Error message
require_auth method %q cannot be mixed with negative methods
What it means
Error "require_auth method %q cannot be mixed with negative methods" thrown in jackc/pgx.
Source
Thrown at pgconn/require_auth.go:102
neg := strings.HasPrefix(method, "!")
if neg {
method = method[1:]
}
if first {
negated = neg
if negated {
// A negated list starts from "everything allowed, auth not required" and removes
// methods; "!none" below flips authRequired back on.
ra.allowed = 1<<authMethodCount - 1
} else {
ra.authRequired = true
}
first = false
} else if neg != negated {
if neg {
return requireAuth{}, fmt.Errorf("negative require_auth method %q cannot be mixed with non-negative methods", method)
}
return requireAuth{}, fmt.Errorf("require_auth method %q cannot be mixed with negative methods", method)
}
var m authMethod
switch method {
case "password":
m = authMethodPassword
case "md5":
m = authMethodMD5
case "gss":
m = authMethodGSS
case "sspi":
m = authMethodSSPI
case "scram-sha-256":
m = authMethodSCRAMSHA256
case "oauth":
m = authMethodOAuth
case "none":
m = authMethodNoneView on GitHub (pinned to ec1a0befd2)
When it happens
Trigger: Thrown at pgconn/require_auth.go:102 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of jackc/pgx@ec1a0befd2 (2026-08-04).
Data as JSON: /data/errors/19eb71457311faec.json.
Report an issue: GitHub.