iced-rs/iced · error

Tessellate path.

Error message

Tessellate path.

What it means

`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.

Solutions

  1. Validate path points before filling: reject/sanitize NaN, infinite, or wildly out-of-range coordinates.
  2. Check the transform chain (`self.transforms.current`) for NaN/zero-scale values before transforming the path.
  3. Simplify pathological geometry (near-zero-length segments, coincident points) before tessellation.
  4. If triggered by valid geometry, capture the path and file a bug against iced/lyon with the input.

Example fix

// before
frame.fill(&path, Fill::color(color));
// after
if path.points().iter().all(|p| p.x.is_finite() && p.y.is_finite()) {
    frame.fill(&path, Fill::color(color));
}
Defensive patterns

Strategy: validation

Validate before calling

fn points_finite(points: &[iced::Point]) -> bool {
    points.iter().all(|p| p.x.is_finite() && p.y.is_finite())
}

Type guard

fn finite_point(p: &iced::Point) -> bool {
    p.x.is_finite() && p.y.is_finite()
}

Try / catch

// expect() panics; sanitize inputs before reaching the tessellator
if points_finite(&points) {
    frame.fill(&path, style);
} else {
    log::warn!("skipping fill: non-finite path points");
}

Prevention

When it happens

Trigger: `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.

Common situations: 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.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of iced-rs/iced@d146509d89 (2026-09-11). Data as JSON: /api/errors/4702a1b32bf431bb. Report an issue: GitHub.

Appendix: source

Thrown at wgpu/src/geometry.rs:167

    fn fill(&mut self, path: &Path, fill: impl Into<Fill>) {
        let Fill { style, rule } = fill.into();

        let mut buffer = self
            .buffers
            .get_fill(&self.transforms.current.transform_style(style));

        let options = tessellation::FillOptions::default().with_fill_rule(into_fill_rule(rule));

        if self.transforms.current.is_identity() {
            self.fill_tessellator
                .tessellate_path(path.raw(), &options, buffer.as_mut())
        } else {
            let path = path.transform(&self.transforms.current.0);

            self.fill_tessellator
                .tessellate_path(path.raw(), &options, buffer.as_mut())
        }
        .expect("Tessellate path.");
    }

    fn fill_rectangle(&mut self, top_left: Point, size: Size, fill: impl Into<Fill>) {
        let Fill { style, rule } = fill.into();

        let mut buffer = self
            .buffers
            .get_fill(&self.transforms.current.transform_style(style));

        let top_left = self
            .transforms
            .current
            .0
            .transform_point(lyon::math::Point::new(top_left.x, top_left.y));

        let size = self
            .transforms
            .current

View on GitHub (pinned to d146509d89)