jackc/pgx · error

Circle

Error message

Circle: %w

What it means

Wrapping error from the binary circle scan plan: after reading the three float64 components (x, y, r) the pgio.Reader still had unread bytes, meaning the binary encoding was not exactly 24 bytes. The truncated/oversized payload is the fault, not the target.

Solutions

  1. Treat as protocol/data corruption — verify the column type is circle and the wire data is intact
  2. Check for a man-in-the-middle or mismatched pgx/server versions
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pgtype/circle.go:176 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/7ac8b41ed565de1e. Report an issue: GitHub.

Appendix: source

Thrown at pgtype/circle.go:176

}

type scanPlanBinaryCircleToCircleScanner struct{}

func (scanPlanBinaryCircleToCircleScanner) Scan(src []byte, dst any) error {
	scanner := (dst).(CircleScanner)

	if src == nil {
		return scanner.ScanCircle(Circle{})
	}

	rd := pgio.NewReader(src)

	x := rd.Uint64()
	y := rd.Uint64()
	r := rd.Uint64()

	if err := rd.Finish(); err != nil {
		return fmt.Errorf("Circle: %w", err)
	}

	return scanner.ScanCircle(Circle{
		P:     Vec2{math.Float64frombits(x), math.Float64frombits(y)},
		R:     math.Float64frombits(r),
		Valid: true,
	})
}

type scanPlanTextAnyToCircleScanner struct{}

func (scanPlanTextAnyToCircleScanner) Scan(src []byte, dst any) error {
	scanner := (dst).(CircleScanner)

	if src == nil {
		return scanner.ScanCircle(Circle{})
	}

View on GitHub (pinned to ec1a0befd2)