jackc/pgx · error

point

Error message

point: %w

What it means

After reading the two float64 coordinates of a binary-format point, the pgio.Reader found leftover unread bytes (r.Finish() failed). The server sent a point payload that is not exactly 16 bytes, so the decoded x/y pair cannot be trusted.

Solutions

  1. Treat the value as corrupt: discard the partial Point and surface the error to the caller
  2. Verify the column type is actually PostgreSQL point and the wire format negotiated is binary
  3. Log the offending payload length to identify middleware or a proxy rewriting the data
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pgtype/point.go:229 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/9e609258ba1866ca. Report an issue: GitHub.

Appendix: source

Thrown at pgtype/point.go:229

	return point, nil
}

type scanPlanBinaryPointToPointScanner struct{}

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

	if src == nil {
		return scanner.ScanPoint(Point{})
	}

	r := pgio.NewReader(src)

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

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

	return scanner.ScanPoint(Point{
		P:     Vec2{math.Float64frombits(x), math.Float64frombits(y)},
		Valid: true,
	})
}

type scanPlanTextAnyToPointScanner struct{}

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

	if src == nil {
		return scanner.ScanPoint(Point{})
	}

	if len(src) < 5 {

View on GitHub (pinned to ec1a0befd2)