typst/typst · error
cannot expand into infinite height
Error message
cannot expand into infinite height
What it means
Raised in layout_fragment_impl when the region's available height is infinite while expansion along y is requested. The content is being laid out in a vertically unbounded context (e.g. inside a block with auto height in an infinite region) but asks to expand to the full height, which would require a frame of infinite size.
Source
Thrown at crates/typst-layout/src/flow/mod.rs:136
#[expect(clippy::too_many_arguments)]
fn layout_fragment_impl(
world: Tracked<dyn World + '_>,
library: &LazyHash<Library>,
introspector: Tracked<dyn Introspector + '_>,
traced: Tracked<Traced>,
sink: TrackedMut<Sink>,
route: Tracked<Route>,
content: &Content,
locator: Tracked<Locator>,
styles: StyleChain,
regions: Regions,
column: ColumnOptions,
) -> SourceResult<Fragment> {
if !regions.size.x.is_finite() && regions.expand.x {
bail!(content.span(), "cannot expand into infinite width");
}
if !regions.size.y.is_finite() && regions.expand.y {
bail!(content.span(), "cannot expand into infinite height");
}
let introspector = Protected::from_raw(introspector);
let link = LocatorLink::new(locator);
let mut locator = Locator::link(&link).split();
let mut engine = Engine {
library,
world,
introspector,
traced,
sink,
route: Route::extend(route),
};
engine.route.check_layout_depth().at(content.span())?;
let mut kind = FragmentKind::Block;
let arenas = Arenas::default();View on GitHub (pinned to 6a6f1a97a3)
Solutions
- Give the enclosing container a finite height
- Avoid expandable height in vertically unbounded contexts such as nested auto-height blocks
- Move the content to a context with a defined height (e.g. the page body)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/typst-layout/src/flow/mod.rs:133 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of typst/typst@6a6f1a97a3 (2026-08-17).
Data as JSON: /api/errors/9128dbf571c89509.
Report an issue: GitHub.