{"id":"77c7dc1d3c6d546f","repo":"jackc/pgx","slug":"invalid-length-for-polygon-with-d-points-w","errorCode":null,"errorMessage":"invalid length for Polygon with %d points: %w","messagePattern":"invalid length for Polygon with (.+?) points: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/polygon.go","lineNumber":181,"sourceCode":"\t}\n\n\tr := pgio.NewReader(src)\n\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 polygon: %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 Polygon with %d points: %w\", pointCount, err)\n\t}\n\n\treturn scanner.ScanPolygon(Polygon{\n\t\tP:     points,\n\t\tValid: true,\n\t})\n}\n\ntype scanPlanTextAnyToPolygonScanner struct{}\n\nfunc (scanPlanTextAnyToPolygonScanner) Scan(src []byte, dst any) error {\n\tscanner := (dst).(PolygonScanner)\n\n\tif src == nil {\n\t\treturn scanner.ScanPolygon(Polygon{})\n\t}\n\n\tif len(src) < 7 {","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/polygon.go#L163-L199","documentation":"Error \"invalid length for Polygon with %d points: %w\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgtype/polygon.go:181 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","schemaVersion":2}