jackc/pgx · error
unknown boolean string representation %q
Error message
unknown boolean string representation %q
What it means
Error "unknown boolean string representation %q" thrown in jackc/pgx.
Source
Thrown at pgtype/bool.go:344
v, err := planTextToBool(src)
if err != nil {
return err
}
return s.ScanBool(Bool{Bool: v, Valid: true})
}
// https://www.postgresql.org/docs/current/datatype-boolean.html
func planTextToBool(src []byte) (bool, error) {
s := string(bytes.ToLower(bytes.TrimSpace(src)))
switch {
case strings.HasPrefix("true", s), strings.HasPrefix("yes", s), s == "on", s == "1": //nolint:gocritic // s is intentionally the prefix argument so partial inputs (t, tr, tru) also match.
return true, nil
case strings.HasPrefix("false", s), strings.HasPrefix("no", s), strings.HasPrefix("off", s), s == "0": //nolint:gocritic // s is intentionally the prefix argument so partial inputs (f, fa, fal) also match.
return false, nil
default:
return false, fmt.Errorf("unknown boolean string representation %q", src)
}
}
View on GitHub (pinned to ec1a0befd2)
When it happens
Trigger: Thrown at pgtype/bool.go:344 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/7d884bde86211356.json.
Report an issue: GitHub.