{"record":{"id":"4b29758d9f62a9e3","repo":"overleaf/overleaf","slug":"missing-column-specification","errorCode":null,"errorMessage":"Missing column specification","messagePattern":"Missing column specification","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"services/web/frontend/js/features/source-editor/components/table-generator/utils.ts","lineNumber":459,"sourceCode":"  table: TableData\n  cellPositions: CellPosition[][]\n  specification: { from: number; to: number }\n  rowPositions: RowPosition[]\n  rowSeparators: RowSeparator[]\n  cellSeparators: CellSeparator[][]\n}\n\nexport function generateTable(\n  node: SyntaxNode,\n  state: EditorState\n): ParsedTableData {\n  const specification = node\n    .getChild('BeginEnv')\n    ?.getChild('TextArgument')\n    ?.getChild('LongArg')\n\n  if (!specification) {\n    throw new Error('Missing column specification')\n  }\n  const columns = parseColumnSpecifications(\n    state.sliceDoc(specification.from, specification.to)\n  )\n  const body = node.getChild('Content')?.getChild('TabularContent')\n  if (!body) {\n    throw new Error('Missing table body')\n  }\n  const tableData = parseTabularBody(body, state)\n  const cellPositions = tableData.rows.map(row =>\n    row.cells.map(cell => cell.multiColumn?.position ?? cell.position)\n  )\n  const cellSeparators = tableData.rows.map(row => row.cellSeparators)\n  const rowPositions = tableData.rows.map(row => ({\n    ...row.position,\n    hlines: row.hlines.map(hline => hline.position),\n  }))\n  const rows = tableData.rows.map(row => ({","sourceCodeStart":441,"sourceCodeEnd":477,"githubUrl":"https://github.com/overleaf/overleaf/blob/28ad3b03b71cb4311decdcb55c36b33ec10d72db/services/web/frontend/js/features/source-editor/components/table-generator/utils.ts#L441-L477","documentation":"generateTable inspects the parsed syntax tree of a tabular environment and extracts the column specification (e.g. {lcr|p{2cm}}) from the BeginEnv's TextArgument LongArg child. If that argument is absent or malformed in the tree, the table cannot be laid out, so generateTable throws this error before parsing columns.","triggerScenarios":"Calling generateTable (via the syntax-tree `enter` callback) on a tabular node whose \\begin{tabular} lacks a `{...}` column-spec argument, e.g. `\\begin{tabular}` with no `{ll}`, or an empty/malformed TextArgument.","commonSituations":"Hand-editing LaTeX and deleting the column spec; snippets missing the argument; incomplete paste of a table; tools that generate tabular environments without specs.","solutions":["Add a column specification argument to the environment: \\begin{tabular}{|l|c|r|}","Verify the spec is inside braces directly after \\begin{tabular} (or tabularx etc.)","Check for unclosed braces that swallow the TextArgument so the parser drops it"],"exampleFix":"// before\n\\begin{tabular}\n  a & b \\\\\n\\end{tabular}\n// after\n\\begin{tabular}{ll}\n  a & b \\\\\n\\end{tabular}","handlingStrategy":"validation","validationCode":"function hasColumnSpec(latex) {\n  const m = /\\\\begin\\{tabular\\*?\\}\\s*\\{[^}]*\\}/.exec(latex);\n  return !!m;\n}\nif (!hasColumnSpec(source)) throw new Error('Add a {…} column spec to \\\\begin{tabular}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never delete the {...} argument directly after \\begin{tabular}","Use snippets/templates that always include a column spec","Count columns in the spec (l/c/r/p) matches actual cell counts"],"tags":["latex","table-generator","syntax-tree"],"backgroundTag":"missing-column-specification","analyzedSha":"28ad3b03b71cb4311decdcb55c36b33ec10d72db","analyzedAt":"2026-09-03T02:10:22.807Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}