{"record":{"id":"ad5bd3d0c600ed77","repo":"jackc/pgx","slug":"invalid-length-for-path-v","errorCode":null,"errorMessage":"invalid length for Path: %v","messagePattern":"invalid length for Path: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/path.go","lineNumber":217,"sourceCode":"\n\treturn scanner.ScanPath(Path{\n\t\tP:      points,\n\t\tClosed: closed,\n\t\tValid:  true,\n\t})\n}\n\ntype scanPlanTextAnyToPathScanner struct{}\n\nfunc (scanPlanTextAnyToPathScanner) Scan(src []byte, dst any) error {\n\tscanner := (dst).(PathScanner)\n\n\tif src == nil {\n\t\treturn scanner.ScanPath(Path{})\n\t}\n\n\tif len(src) < 7 {\n\t\treturn fmt.Errorf(\"invalid length for Path: %v\", len(src))\n\t}\n\n\tclosed := src[0] == '('\n\tpoints := make([]Vec2, 0)\n\n\t// Expected format: ((x1,y1),...,(xn,yn)) or [(x1,y1),...,(xn,yn)]\n\tstr := string(src[1 : len(src)-1])\n\n\tfor {\n\t\tif len(str) == 0 || str[0] != '(' {\n\t\t\treturn fmt.Errorf(\"invalid format for Path\")\n\t\t}\n\t\tbody, rest, found := strings.Cut(str[1:], \")\")\n\t\tif !found {\n\t\t\treturn fmt.Errorf(\"invalid format for Path\")\n\t\t}\n\n\t\tsx, sy, found := strings.Cut(body, \",\")","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/path.go#L199-L235","documentation":"The textual path format '((x1,y1),...)' or '[(x1,y1),...]' has a 7-byte minimum (two parenthesized point pairs with delimiters). This guard fires before parsing when the source is shorter, so the string cannot possibly be a well-formed path literal.","triggerScenarios":"Thrown at pgtype/path.go:217 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the stored string matches the '((x1,y1),(x2,y2))' path text format","Fix any custom code writing truncated path strings","Use binary format for the column"],"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"}