jackc/pgx · error
invalid lower value
Error message
invalid lower value: %w
What it means
After the opening bracket, the parser could not read the first rune of the lower bound value (buffer read error, typically end of input). The wrapped error comes from the underlying bytes.Buffer, meaning the string ended right after '(' or '['.
Solutions
- Check the range string is complete and not truncated after the opening bracket
- Validate input length before parsing
- Log the raw string to identify truncation at the source
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pgtype/range.go:57 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/6c4ddb7bbd7d1876.
Report an issue: GitHub.
Appendix: source
Thrown at pgtype/range.go:57
skipWhitespace(buf)
r, _, err := buf.ReadRune()
if err != nil {
return nil, fmt.Errorf("invalid lower bound: %w", err)
}
switch r {
case '(':
utr.LowerType = Exclusive
case '[':
utr.LowerType = Inclusive
default:
return nil, fmt.Errorf("missing lower bound, instead got: %v", string(r))
}
r, _, err = buf.ReadRune()
if err != nil {
return nil, fmt.Errorf("invalid lower value: %w", err)
}
buf.UnreadRune()
if r == ',' {
utr.LowerType = Unbounded
} else {
utr.Lower, err = rangeParseValue(buf)
if err != nil {
return nil, fmt.Errorf("invalid lower value: %w", err)
}
}
r, _, err = buf.ReadRune()
if err != nil {
return nil, fmt.Errorf("missing range separator: %w", err)
}
if r != ',' {
return nil, fmt.Errorf("missing range separator: %v", r)View on GitHub (pinned to ec1a0befd2)