{"record":{"id":"86e33d23e5494c68","repo":"iced-rs/iced","slug":"stroke-path","errorCode":null,"errorMessage":"Stroke path","messagePattern":"Stroke path","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu/src/geometry.rs","lineNumber":228,"sourceCode":"        options.end_cap = into_line_cap(stroke.line_cap);\n        options.line_join = into_line_join(stroke.line_join);\n\n        let path = if stroke.line_dash.segments.is_empty() {\n            Cow::Borrowed(path)\n        } else {\n            Cow::Owned(dashed(path, stroke.line_dash))\n        };\n\n        if self.transforms.current.is_identity() {\n            self.stroke_tessellator\n                .tessellate_path(path.raw(), &options, buffer.as_mut())\n        } else {\n            let path = path.transform(&self.transforms.current.0);\n\n            self.stroke_tessellator\n                .tessellate_path(path.raw(), &options, buffer.as_mut())\n        }\n        .expect(\"Stroke path\");\n    }\n\n    fn stroke_rectangle<'a>(&mut self, top_left: Point, size: Size, stroke: impl Into<Stroke<'a>>) {\n        let stroke = stroke.into();\n\n        let mut buffer = self\n            .buffers\n            .get_stroke(&self.transforms.current.transform_style(stroke.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":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/iced-rs/iced/blob/d146509d893945de5c304cfaf4301335eee278bd/wgpu/src/geometry.rs#L210-L246","documentation":"This panic occurs in the Iced wgpu backend when lyon's stroke tessellator fails to convert a transformed path's stroke outline into triangles. The library asserts success with .expect because stroke failure is treated as an internal invariant violation rather than a recoverable condition. It indicates the path geometry or stroke options produced an invalid tessellation (e.g. non-finite coordinates or an unsupported stroke configuration).","triggerScenarios":"Calling Stroke on a Path whose transformed points contain NaN/infinity (bad transform matrix or degenerate geometry), or with stroke options that lyon's CPU tessellator cannot process, inside geometry::Path::stroke with a non-rectangle/text path.","commonSituations":"Animatable transforms interpolating through singular/NaN matrices, paths built from external SVG data containing degenerate or zero-length segments, oversized stroke widths, or geometry passed through a custom widget that bypassed validation.","solutions":["Validate the path's points and the transform matrix are finite before stroking (reject NaN/inf).","Check the stroke width and options (line cap/join, miter limit) are sane positive values.","If geometry comes from user input or external files, sanitize/simplify degenerate segments before building the Path.","Update iced/lyon; some tessellation panics on edge-case geometry are fixed in newer releases.","As a workaround, wrap rendering of untrusted geometry so a panic in a custom widget cannot take down the app, or rasterize it via a cache checked for validity first."],"exampleFix":"// before\nlet path = path.transform(&self.transforms.current.0);\nself.stroke_tessellator.tessellate_path(path.raw(), &options, buffer.as_mut()).expect(\"Stroke path\");\n// after (caller-side guard)\nif path.bounds().is_valid() && transform.is_finite() {\n    frame.stroke(&path, stroke);\n}","handlingStrategy":"validation","validationCode":"fn is_finite_path(p: &iced::widget::canvas::Path, t: &iced::Transformation) -> bool {\n    // all cached points and the transform must be finite before stroking\n    t.is_finite() // extend to iterate path points in custom geometry code\n}","typeGuard":"fn valid_transform(t: &iced::Transformation) -> bool {\n    let m = t.as_ref();\n    m.iter().all(|v| v.is_finite())\n}","tryCatchPattern":null,"preventionTips":["Never build Paths from raw external data without NaN/inf checks.","Clamp stroke width to a positive finite value.","Guard animation interpolation so transforms never pass through singular/NaN states.","Pin and update iced/lyon versions together."],"tags":["graphics","tessellation","panic","lyon"],"backgroundTag":"internal-invariant-violation","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"}