{"record":{"id":"0f94f5254df76320","repo":"typst/typst","slug":"too-many-cells-or-lines-were-given","errorCode":null,"errorMessage":"too many cells or lines were given","messagePattern":"too many cells or lines were given","errorType":"validation","errorClass":"SourceDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/typst-library/src/layout/grid/resolve.rs","lineNumber":1073,"sourceCode":"        // those (when the table child being processed is a single cell),\n        // 'local_auto_index' will simply be an alias for 'auto_index', which\n        // will be updated after that cell is placed, if it is an\n        // automatically-positioned cell.\n        let mut auto_index: usize = 0;\n\n        // We have to rebuild the grid to account for fixed cell positions.\n        //\n        // Create at least 'children.len()' positions, since there could be at\n        // least 'children.len()' cells (if no explicit lines were specified),\n        // even though some of them might be placed in fixed positions and thus\n        // cause the grid to expand.\n        //\n        // Additionally, make sure we allocate up to the next multiple of\n        // 'columns', since each row will have 'columns' cells, even if the\n        // last few cells weren't explicitly specified by the user.\n        let children = children.into_iter();\n        let Some(child_count) = children.len().checked_next_multiple_of(columns) else {\n            bail!(self.span, \"too many cells or lines were given\")\n        };\n\n        // Rows in this bitset are occupied by an existing header.\n        // This allows for efficiently checking whether a cell would collide\n        // with a header at a certain row. (For footers, it's easy as there is\n        // only one.)\n        //\n        // TODO(subfooters): how to add a footer here while avoiding\n        // unnecessary allocations?\n        let mut header_rows = SmallBitSet::new();\n        let mut resolved_cells: Vec<Option<Entry>> = Vec::with_capacity(child_count);\n        for child in children {\n            self.resolve_grid_child(\n                columns,\n                &mut pending_hlines,\n                &mut pending_vlines,\n                &mut header_rows,\n                &mut headers,","sourceCodeStart":1055,"sourceCodeEnd":1091,"githubUrl":"https://github.com/typst/typst/blob/35417aa769ab9d699a60384f91082b09bc6ba421/crates/typst-library/src/layout/grid/resolve.rs#L1055-L1091","documentation":"Raised during grid layout resolution: the total number of resolved cells plus explicitly positioned lines exceeds the grid capacity implied by the specified column-count and any fixed positions, so the grid cannot accommodate everything given.","triggerScenarios":"Thrown at crates/typst-library/src/layout/grid/resolve.rs:1073 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Increase the number of `columns` in the grid","Remove some cells or explicit hlines/vlines","Check that fixed cell positions (x/y) do not overflow the grid dimensions"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35417aa769ab9d699a60384f91082b09bc6ba421","analyzedAt":"2026-08-17T21:03:48.984Z","contentChangedAt":"2026-08-17T21:03:48.984Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}