{"record":{"id":"a119cf0e713ce6e6","repo":"jackc/pgx","slug":"invalid-format-for-path","errorCode":null,"errorMessage":"invalid format for Path","messagePattern":"invalid format for Path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/path.go","lineNumber":228,"sourceCode":"\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, \",\")\n\t\tif !found {\n\t\t\treturn fmt.Errorf(\"invalid format for Path\")\n\t\t}\n\t\tx, err := strconv.ParseFloat(sx, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ty, err := strconv.ParseFloat(sy, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/path.go#L210-L246","documentation":"Textual path parsing walks the inner string expecting a sequence of '(x,y)' point groups; at each step the next character must open a point and each point must close with ')' and contain a comma. This guard fires at any of those expectation failures — the content between the outer delimiters is not a comma-separated list of parenthesized coordinate pairs.","triggerScenarios":"Thrown at pgtype/path.go:228 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Store paths in canonical '((x1,y1),(x2,y2))' or '[...]' text form","Validate and normalize path strings before insertion","Use binary format encoding for path columns"],"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"}