jackc/pgx · error
invalid format for Circle
Error message
invalid format for Circle
What it means
The text circle value does not follow PostgreSQL's <(x,y),r> format: it is missing the leading '<(' or trailing '>' delimiter after other checks passed. The faulting input is the malformed text representation in src.
Solutions
- Supply the value in PostgreSQL circle text format '<(x,y),r>'
- Cast the column to text in SQL if the underlying value is a different type
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pgtype/circle.go:202 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/bffd778079efaa22.
Report an issue: GitHub.
Appendix: source
Thrown at pgtype/circle.go:202
}
type scanPlanTextAnyToCircleScanner struct{}
func (scanPlanTextAnyToCircleScanner) Scan(src []byte, dst any) error {
scanner := (dst).(CircleScanner)
if src == nil {
return scanner.ScanCircle(Circle{})
}
if len(src) < 9 {
return fmt.Errorf("invalid length for Circle: %v", len(src))
}
// Expected format: <(x,y),r>
str, ok := strings.CutPrefix(string(src), "<(")
if !ok {
return fmt.Errorf("invalid format for Circle")
}
str, ok = strings.CutSuffix(str, ">")
if !ok {
return fmt.Errorf("invalid format for Circle")
}
sx, str, found := strings.Cut(str, ",")
if !found {
return fmt.Errorf("invalid format for Circle")
}
sy, sr, found := strings.Cut(str, "),")
if !found {
return fmt.Errorf("invalid format for Circle")
}
x, err := strconv.ParseFloat(sx, 64)
if err != nil {
return errView on GitHub (pinned to ec1a0befd2)