{"record":{"id":"37b404c1f989dcaa","repo":"iced-rs/iced","slug":"stroke-rectangle","errorCode":null,"errorMessage":"Stroke rectangle","messagePattern":"Stroke rectangle","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu/src/geometry.rs","lineNumber":262,"sourceCode":"        let size = self\n            .transforms\n            .current\n            .0\n            .transform_vector(lyon::math::Vector::new(size.width, size.height));\n\n        let mut options = tessellation::StrokeOptions::default();\n        options.line_width = stroke.width;\n        options.start_cap = into_line_cap(stroke.line_cap);\n        options.end_cap = into_line_cap(stroke.line_cap);\n        options.line_join = into_line_join(stroke.line_join);\n\n        self.stroke_tessellator\n            .tessellate_rectangle(\n                &lyon::math::Box2D::new(top_left, top_left + size),\n                &options,\n                buffer.as_mut(),\n            )\n            .expect(\"Stroke rectangle\");\n    }\n\n    fn stroke_text<'a>(&mut self, text: impl Into<geometry::Text>, stroke: impl Into<Stroke<'a>>) {\n        let text = text.into();\n        let stroke = stroke.into();\n\n        text.draw_with(|glyph, _color| self.stroke(&glyph, stroke));\n    }\n\n    fn fill_text(&mut self, text: impl Into<geometry::Text>) {\n        let text = text.into();\n\n        let (scale_x, scale_y) = self.transforms.current.scale();\n\n        if self.transforms.current.is_scale_translation()\n            && scale_x == scale_y\n            && scale_x > 0.0\n            && scale_y > 0.0","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/iced-rs/iced/blob/d146509d893945de5c304cfaf4301335eee278bd/wgpu/src/geometry.rs#L244-L280","documentation":"Raised when lyon's stroke tessellator fails on a rectangle stroke in the wgpu backend. The code tessellates a Box2D from top_left and size and asserts success; a panic means the rectangle or stroke options were degenerate (zero/negative size or non-finite values), which lyon treats as an invalid tessellation request.","triggerScenarios":"Calling Stroke::stroke_rectangle (e.g. frame.stroke(Rectangle{..}, ..)) with a size of 0 or negative width/height, or non-finite top_left/size values.","commonSituations":"Layout computing a zero-sized widget (collapsed container, display:none-like sizing) that still gets stroked; animation interpolating a size through zero; fractional scaling producing NaN sizes.","solutions":["Ensure the rectangle's width and height are > 0 and finite before stroking it.","Skip stroking widgets whose computed size is zero in your view code.","Clamp animated sizes to a small positive minimum when animating to zero.","Update iced/lyon for newer tessellator handling of degenerate rectangles."],"exampleFix":"// before\nframe.stroke(rect, Stroke::default().width(2.0));\n// after\nif rect.width > 0.0 && rect.height > 0.0 {\n    frame.stroke(rect, Stroke::default().width(2.0));\n}","handlingStrategy":"validation","validationCode":"if !(rect.width > 0.0 && rect.height > 0.0\n    && rect.width.is_finite() && rect.height.is_finite()) {\n    return; // skip stroking degenerate rectangle\n}","typeGuard":"fn is_strokable(r: &iced::Rectangle) -> bool {\n    r.width > 0.0 && r.height > 0.0 && r.width.is_finite() && r.height.is_finite()\n}","tryCatchPattern":null,"preventionTips":["Skip stroking widgets with zero computed size.","Clamp animated sizes away from exactly zero.","Sanitize layout-derived floats before drawing."],"tags":["graphics","tessellation","panic","rectangle"],"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"}