{"record":{"id":"2939e55f52d6f823","repo":"jackc/pgx","slug":"invalid-length-for-point-v","errorCode":null,"errorMessage":"invalid length for point: %v","messagePattern":"invalid length for point: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/point.go","lineNumber":49,"sourceCode":"\n// ScanPoint implements the [PointScanner] interface.\nfunc (p *Point) ScanPoint(v Point) error {\n\t*p = v\n\treturn nil\n}\n\n// PointValue implements the [PointValuer] interface.\nfunc (p Point) PointValue() (Point, error) {\n\treturn p, nil\n}\n\nfunc parsePoint(src []byte) (*Point, error) {\n\tif src == nil || bytes.Equal(src, []byte(\"null\")) {\n\t\treturn &Point{}, nil\n\t}\n\n\tif len(src) < 5 {\n\t\treturn nil, fmt.Errorf(\"invalid length for point: %v\", len(src))\n\t}\n\tif src[0] == '\"' && src[len(src)-1] == '\"' {\n\t\tsrc = src[1 : len(src)-1]\n\t}\n\tsx, sy, found := strings.Cut(string(src[1:len(src)-1]), \",\")\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"invalid format for point\")\n\t}\n\n\tx, err := strconv.ParseFloat(sx, 64)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ty, err := strconv.ParseFloat(sy, 64)\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/point.go#L31-L67","documentation":"parsePoint parses the textual '(x,y)' point representation (optionally JSON-quoted). This length guard fires when the source is shorter than the 5-byte minimum — even the shortest possible point like '(1,2)' — so the string cannot possibly contain a coordinate pair. It is reached from Point's JSON unmarshaling and text scanning.","triggerScenarios":"Thrown at pgtype/point.go:49 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure point values are in '(x,y)' text form (or JSON \"(x,y)\")","Validate JSON input length before parsing","Fix custom code producing truncated point strings"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}