BookStackApp/BookStack · error · Error
Expected table cell to be inside of table row.
Error message
Expected table cell to be inside of table row.
What it means
Internal invariant in $getTableRowNodeFromTableCellNodeOrThrow: walking parents from the given node finds no TableRowNode, meaning the starting node is not (or not inside) a table cell within a row. Input at fault: a LexicalNode outside a table row structure.
Source
Thrown at resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts:103
const node = $findMatchingParent(startingNode, (n) => $isTableCellNode(n));
if ($isTableCellNode(node)) {
return node;
}
return null;
}
export function $getTableRowNodeFromTableCellNodeOrThrow(
startingNode: LexicalNode,
): TableRowNode {
const node = $findMatchingParent(startingNode, (n) => $isTableRowNode(n));
if ($isTableRowNode(node)) {
return node;
}
throw new Error('Expected table cell to be inside of table row.');
}
export function $getTableNodeFromLexicalNodeOrThrow(
startingNode: LexicalNode,
): TableNode {
const node = $findMatchingParent(startingNode, (n) => $isTableNode(n));
if ($isTableNode(node)) {
return node;
}
throw new Error('Expected table cell to be inside of table.');
}
export function $getTableRowIndexFromTableCellNode(
tableCellNode: TableCellNode,
): number {
const tableRowNode = $getTableRowNodeFromTableCellNodeOrThrow(tableCellNode);View on GitHub (pinned to 18f8469a1c)
Solutions
- Pass a node that is inside a table cell ($isTableCellNode check first)
- Use the non-throwing $findMatchingParent lookup and handle null before calling the *OrThrow variant
- Check selection anchors actually point into table content before row operations
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts:103 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BookStackApp/BookStack@18f8469a1c (2026-09-02).
Data as JSON: /api/errors/17a3a9c8ba99b390.
Report an issue: GitHub.