{"record":{"id":"4702a1b32bf431bb","repo":"iced-rs/iced","slug":"tessellate-path","errorCode":null,"errorMessage":"Tessellate path.","messagePattern":"Tessellate path\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu/src/geometry.rs","lineNumber":167,"sourceCode":"    fn fill(&mut self, path: &Path, fill: impl Into<Fill>) {\n        let Fill { style, rule } = fill.into();\n\n        let mut buffer = self\n            .buffers\n            .get_fill(&self.transforms.current.transform_style(style));\n\n        let options = tessellation::FillOptions::default().with_fill_rule(into_fill_rule(rule));\n\n        if self.transforms.current.is_identity() {\n            self.fill_tessellator\n                .tessellate_path(path.raw(), &options, buffer.as_mut())\n        } else {\n            let path = path.transform(&self.transforms.current.0);\n\n            self.fill_tessellator\n                .tessellate_path(path.raw(), &options, buffer.as_mut())\n        }\n        .expect(\"Tessellate path.\");\n    }\n\n    fn fill_rectangle(&mut self, top_left: Point, size: Size, fill: impl Into<Fill>) {\n        let Fill { style, rule } = fill.into();\n\n        let mut buffer = self\n            .buffers\n            .get_fill(&self.transforms.current.transform_style(style));\n\n        let top_left = self\n            .transforms\n            .current\n            .0\n            .transform_point(lyon::math::Point::new(top_left.x, top_left.y));\n\n        let size = self\n            .transforms\n            .current","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/iced-rs/iced/blob/d146509d893945de5c304cfaf4301335eee278bd/wgpu/src/geometry.rs#L149-L185","documentation":"`Geometry::fill` runs the lyon `fill_tessellator` over a transformed path and calls `.expect(\"Tessellate path.\")` on the result, panicking if tessellation fails. Lyon returns an error for pathological geometry (invalid/degenerate paths) or internal tessellation failures, which iced's geometry layer surfaces as a panic instead of an error value.","triggerScenarios":"`Geometry`/`Frame::fill(&path, style)` with a path whose tessellation errors — e.g. NaN coordinates from transforms or points, extremely degenerate/self-intersecting input accepted by lyon's error path, or a vertex buffer/allocator failure while filling the output.","commonSituations":"Paths built from floating-point data that contains NaN/Infinity (bad math, division by zero in generators); identity-like transforms with NaN scale; very large coordinate values overflowing lyon's internal tolerances; custom Path building code producing malformed subpaths.","solutions":["Validate path points before filling: reject/sanitize NaN, infinite, or wildly out-of-range coordinates.","Check the transform chain (`self.transforms.current`) for NaN/zero-scale values before transforming the path.","Simplify pathological geometry (near-zero-length segments, coincident points) before tessellation.","If triggered by valid geometry, capture the path and file a bug against iced/lyon with the input."],"exampleFix":"// before\nframe.fill(&path, Fill::color(color));\n// after\nif path.points().iter().all(|p| p.x.is_finite() && p.y.is_finite()) {\n    frame.fill(&path, Fill::color(color));\n}","handlingStrategy":"validation","validationCode":"fn points_finite(points: &[iced::Point]) -> bool {\n    points.iter().all(|p| p.x.is_finite() && p.y.is_finite())\n}","typeGuard":"fn finite_point(p: &iced::Point) -> bool {\n    p.x.is_finite() && p.y.is_finite()\n}","tryCatchPattern":"// expect() panics; sanitize inputs before reaching the tessellator\nif points_finite(&points) {\n    frame.fill(&path, style);\n} else {\n    log::warn!(\"skipping fill: non-finite path points\");\n}","preventionTips":["Sanitize all generated points for NaN/Infinity before building paths.","Check transforms (scale/rotation) for NaN before applying them to geometry.","Avoid extreme coordinate magnitudes that overflow f32 tolerances.","Keep tessellation-heavy drawing in debug-tested custom widgets."],"tags":["rust","wgpu","lyon","tessellation","geometry","panic"],"backgroundTag":"invalid-argument-value","analyzedSha":"d146509d893945de5c304cfaf4301335eee278bd","analyzedAt":"2026-09-11T16:54:14.229Z","contentChangedAt":"2026-09-11T16:54:14.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}