typst/typst · error
cannot create curve with infinite size
Error message
cannot create curve with infinite size
What it means
Check in layout_curve: after building the curve from its components, the computed bounding size is infinite, so the curve cannot be laid out; usually a component coordinate resolves to infinity relative to an unbounded region.
Source
Thrown at crates/typst-layout/src/shapes.rs:120
Some(p) => builder.resolve_point(p, relative),
None => end,
};
builder.cubic(c1, c2, end);
}
CurveComponent::Close(element) => {
builder.close(element.mode.get(styles));
}
}
}
let (curve, size) = builder.finish();
if curve.is_empty() {
return Ok(Frame::soft(size));
}
if !size.is_finite() {
bail!(elem.span(), "cannot create curve with infinite size");
}
// Prepare fill and stroke.
let fill = elem.fill.get_cloned(styles);
let fill_rule = elem.fill_rule.get(styles);
let stroke = match elem.stroke.resolve(styles) {
Smart::Auto if fill.is_none() => Some(FixedStroke::default()),
Smart::Auto => None,
Smart::Custom(stroke) => stroke.map(Stroke::unwrap_or_default),
};
let mut frame = Frame::soft(size);
let shape = Shape {
geometry: Geometry::Curve(curve),
stroke,
fill,
fill_rule,
};View on GitHub (pinned to 35417aa769)
Solutions
- Use finite coordinates for all curve components
- Place the curve inside a container with a definite finite size
- Avoid fractional/infinite lengths in curve point and control-point coordinates
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/typst-layout/src/shapes.rs:120 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of typst/typst@35417aa769 (2026-08-17).
Data as JSON: /api/errors/5f6eb17b8e569d18.
Report an issue: GitHub.