{"record":{"id":"c7617d98405e12d9","repo":"jackc/pgx","slug":"invalid-length-for-path-w","errorCode":null,"errorMessage":"invalid length for Path: %w","messagePattern":"invalid length for Path: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/path.go","lineNumber":186,"sourceCode":"\treturn nil\n}\n\ntype scanPlanBinaryPathToPathScanner struct{}\n\nfunc (scanPlanBinaryPathToPathScanner) 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\tr := pgio.NewReader(src)\n\n\tclosed := r.Byte() == 1\n\t// Each point is two float64s.\n\tpointCount := r.Count(16)\n\tif err := r.Err(); err != nil {\n\t\treturn fmt.Errorf(\"invalid length for Path: %w\", err)\n\t}\n\n\tpoints := make([]Vec2, pointCount)\n\tfor i := range points {\n\t\tx := r.Uint64()\n\t\ty := r.Uint64()\n\t\tpoints[i] = Vec2{math.Float64frombits(x), math.Float64frombits(y)}\n\t}\n\n\tif err := r.Finish(); err != nil {\n\t\treturn fmt.Errorf(\"invalid length for Path with %d points: %w\", pointCount, err)\n\t}\n\n\treturn scanner.ScanPath(Path{\n\t\tP:      points,\n\t\tClosed: closed,\n\t\tValid:  true,\n\t})","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/path.go#L168-L204","documentation":"When decoding a binary path, the closed flag byte is read first and then the point count is derived from the remaining length divided by 16 (two float64s per point). This wrapper fires when the reader signals an error during that computation — the payload is too short to contain even the header byte plus whole points, i.e. a truncated binary path.","triggerScenarios":"Thrown at pgtype/path.go:186 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the binary path value is complete and well-formed","Use text format for the path column","Check custom binary encoding if the value was client-produced"],"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"}