overleaf/overleaf · error
Missing table body
Error message
Missing table body
What it means
After extracting the column specification, generateTable looks for the Content > TabularContent node that holds the table's rows. If the tabular environment has no TabularContent child (no rows at all), there is nothing to render as a table, so it throws 'Missing table body'.
Source
Thrown at services/web/frontend/js/features/source-editor/components/table-generator/utils.ts:466
export function generateTable(
node: SyntaxNode,
state: EditorState
): ParsedTableData {
const specification = node
.getChild('BeginEnv')
?.getChild('TextArgument')
?.getChild('LongArg')
if (!specification) {
throw new Error('Missing column specification')
}
const columns = parseColumnSpecifications(
state.sliceDoc(specification.from, specification.to)
)
const body = node.getChild('Content')?.getChild('TabularContent')
if (!body) {
throw new Error('Missing table body')
}
const tableData = parseTabularBody(body, state)
const cellPositions = tableData.rows.map(row =>
row.cells.map(cell => cell.multiColumn?.position ?? cell.position)
)
const cellSeparators = tableData.rows.map(row => row.cellSeparators)
const rowPositions = tableData.rows.map(row => ({
...row.position,
hlines: row.hlines.map(hline => hline.position),
}))
const rows = tableData.rows.map(row => ({
cells: row.cells.map(cell => {
const cellData: CellData = {
content: cell.content,
from: cell.position.from,
to: cell.position.to,
}
if (cell.multiColumn) {View on GitHub (pinned to 28ad3b03b7)
Solutions
- Add at least one row of content inside the tabular environment, e.g. `a & b \\`
- Fix any syntax error inside the environment that prevents TabularContent from being parsed
- Remove the empty tabular environment entirely if the table is not needed
Example fix
// before
\begin{tabular}{ll}\end{tabular}
// after
\begin{tabular}{ll}
a & b \\
\end{tabular} Defensive patterns
Strategy: validation
Validate before calling
function hasTableBody(latex) {
const m = /\\begin\{tabular\*?\}[^]*?\\end\{tabular\*?\}/.exec(latex);
return !!m && m[0].replace(/\\begin\{tabular\*?\}[^]*?\}/, '').trim().length > 0;
} Prevention
- Add at least one row before triggering table generation
- Fix unbalanced braces inside the environment so the parser can build TabularContent
- Remove empty tabular stubs instead of leaving them
When it happens
Trigger: Calling generateTable on an empty tabular environment like `\begin{tabular}{ll}\end{tabular}`, or one whose body was not parsed into a Content/TabularContent node due to a syntax error inside the environment.
Common situations: Deleting all table rows while hand-editing; a broken inner construct (unclosed brace or command) preventing TabularContent from parsing; scaffolding an empty table stub then triggering the generator.
Related errors
- Missing column specification
- Missing opening brace
- Missing closing brace
- Invalid multicolumn definition: missing column specification
- Invalid multicolumn definition: missing colspan argument
AI-assisted analysis of overleaf/overleaf@28ad3b03b7 (2026-09-03).
Data as JSON: /api/errors/f725c263f105c495.
Report an issue: GitHub.