jackc/pgx · error
is less than minimum value for Int8
Error message
%d is less than minimum value for Int8
What it means
ScanInt64 on zero-null Int8 guards against an int64 below math.MinInt64 — a condition that cannot arise from a genuine int64 payload, since the field is already the full width. Firing indicates memory corruption or a hand-constructed invalid pgtype.Int8 rather than a plausible data-range problem.
Solutions
- Treat occurrence as a bug: report upstream with the value and query that produced it
- Audit code that constructs pgtype.Int8 literals to ensure only decoded values reach the scanner
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pgtype/zeronull/int.go:140 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/28774b77b7506531.
Report an issue: GitHub.
Appendix: source
Thrown at pgtype/zeronull/int.go:140
return nil, nil
}
return int64(src), nil
}
type Int8 int64
// SkipUnderlyingTypePlan implements the [pgtype.SkipUnderlyingTypePlanner] interface.
func (Int8) SkipUnderlyingTypePlan() {}
// ScanInt64 implements the [pgtype.Int64Scanner] interface.
func (dst *Int8) ScanInt64(n pgtype.Int8) error {
if !n.Valid {
*dst = 0
return nil
}
if n.Int64 < math.MinInt64 {
return fmt.Errorf("%d is less than minimum value for Int8", n.Int64)
}
if n.Int64 > math.MaxInt64 {
return fmt.Errorf("%d is greater than maximum value for Int8", n.Int64)
}
*dst = Int8(n.Int64)
return nil
}
// Int64Value implements the [pgtype.Int64Valuer] interface.
func (src Int8) Int64Value() (pgtype.Int8, error) {
if src == 0 {
return pgtype.Int8{}, nil
}
return pgtype.Int8{Int64: int64(src), Valid: true}, nil
}
// Scan implements the [database/sql.Scanner] interface.View on GitHub (pinned to ec1a0befd2)