typst/typst · error · HintedString

cannot use `table.cell` as a grid cell

Error message

cannot use `table.cell` as a grid cell

What it means

Raised while converting content into a GridItem: a `table.cell` was used as a grid cell. Table cells carry table-specific styling resolution and are rejected in grids.

Source

Thrown at crates/typst-library/src/layout/grid/mod.rs:544

}

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!(
                "cannot use `table.hline` as a grid line";
                hint: "use `grid.hline` instead";
            );
        }
        if value.is::<TableVLine>() {
            bail!(
                "cannot use `table.vline` as a grid line";
                hint: "use `grid.vline` instead";
            );
        }

        Ok(value

View on GitHub (pinned to 35417aa769)

Solutions

  1. Replace `table.cell(...)` with `grid.cell(...)`
  2. Pass plain content directly as a grid child
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/typst-library/src/layout/grid/mod.rs:544 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/0a5067317b2ba209. Report an issue: GitHub.