jackc/pgx · error

invalid require_auth method

Error message

invalid require_auth method: %q

What it means

The require_auth list contains a method name that is not recognized. Valid methods are password, md5, gss, sspi, scram-sha-256, oauth, and none.

Solutions

  1. Check the method name spelling in the require_auth value
  2. Use one of: password, md5, gss, sspi, scram-sha-256, oauth, none
  3. Note the method names are case-sensitive lowercase
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pgconn/require_auth.go:122 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: /api/errors/34a7213fa9b37555. Report an issue: GitHub.

Appendix: source

Thrown at pgconn/require_auth.go:122

		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 = authMethodNone
		default:
			return requireAuth{}, fmt.Errorf("invalid require_auth method: %q", method)
		}

		bit := uint8(1) << m
		if negated {
			if ra.allowed&bit == 0 {
				return requireAuth{}, fmt.Errorf("require_auth method %q is specified more than once", part)
			}
			ra.allowed &^= bit
			if m == authMethodNone {
				ra.authRequired = true
			}
		} else {
			if ra.allowed&bit != 0 {
				return requireAuth{}, fmt.Errorf("require_auth method %q is specified more than once", part)
			}
			ra.allowed |= bit
			if m == authMethodNone {
				ra.authRequired = false

View on GitHub (pinned to ec1a0befd2)