typst/typst · error · HintedString
cannot place a grid header within another header or footer
Error message
cannot place a grid header within another header or footer
What it means
Raised while converting content into a GridItem: a `grid.header` was nested inside another header or footer. Headers and footers can only contain cells and lines, not other repeating groups.
Source
Thrown at crates/typst-library/src/layout/grid/mod.rs:532
}
cast! {
GridItem,
self => match self {
Self::HLine(hline) => hline.into_value(),
Self::VLine(vline) => vline.into_value(),
Self::Cell(cell) => cell.into_value(),
},
v: Content => {
v.try_into()?
}
}
impl TryFrom<Content> for GridItem {
type Error = HintedString;
fn try_from(value: Content) -> HintedStrResult<Self> {
if value.is::<GridHeader>() {
bail!("cannot place a grid header within another header or footer");
}
if value.is::<TableHeader>() {
bail!("cannot place a table header within another header or footer");
}
if value.is::<GridFooter>() {
bail!("cannot place a grid footer within another footer or header");
}
if value.is::<TableFooter>() {
bail!("cannot place a table footer within another footer or header");
}
if value.is::<TableCell>() {
bail!(
"cannot use `table.cell` as a grid cell";
hint: "use `grid.cell` instead";
);
}
if value.is::<TableHLine>() {
bail!(View on GitHub (pinned to 35417aa769)
Solutions
- Move the inner `grid.header` to the top level of the grid's children
- Restrict the header's contents to cells, `grid.hline`, and `grid.vline`
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/typst-library/src/layout/grid/mod.rs:532 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/512e2143600f432e.
Report an issue: GitHub.