BookStackApp/BookStack · error · Error
Node at cords not TableCellNode.
Error message
Node at cords not TableCellNode.
What it means
getCellNodeFromCordsOrThrow maps (x, y) grid coordinates to a TableCellNode via getCellNodeFromCords, which returns null when the coordinates are out of range. This wrapper throws 'Node at cords not TableCellNode.' instead of returning null.
Source
Thrown at resources/js/wysiwyg/lexical/table/LexicalTableNode.ts:293
const node = $getNearestNodeFromDOMNode(cell.elem);
if ($isTableCellNode(node)) {
return node;
}
return null;
}
getCellNodeFromCordsOrThrow(
x: number,
y: number,
table: TableDOMTable,
): TableCellNode {
const node = this.getCellNodeFromCords(x, y, table);
if (!node) {
throw new Error('Node at cords not TableCellNode.');
}
return node;
}
canSelectBefore(): true {
return true;
}
canIndent(): false {
return false;
}
}
export function $getElementForTableNode(
editor: LexicalEditor,
tableNode: TableNode,
): TableDOMTable {View on GitHub (pinned to 18f8469a1c)
Solutions
- Bounds-check target x/y against the grid size before calling selectTableNodeInDirection or getCellNodeFromCordsOrThrow.
- Use the non-throwing getCellNodeFromCords and return early on null.
- Re-derive coordinates from the current selection inside the same editor.update so the grid data is fresh.
- Verify the TableObserver is attached and its table data rebuilt after structural table edits.
Example fix
// before const cellNode = tableNode.getCellNodeFromCordsOrThrow(x, y, table); // throws // after const cellNode = tableNode.getCellNodeFromCords(x, y, table); if (!cellNode) return;
Defensive patterns
Strategy: validation
Validate before calling
const rows = tableNode.getRows(); const cols = tableNode.getColumns?.() ?? 0; if (x < 0 || y < 0 || y >= rows.length || x >= cols) return; // skip out-of-bounds selection
Try / catch
try {
const node = tableNode.getCellNodeFromCordsOrThrow(x, y, table);
} catch (e) {
if (e instanceof Error && e.message === 'Node at cords not TableCellNode.') return;
throw e;
} Prevention
- Bounds-check x/y against getRows()/getColumns() before directional selection
- Derive coordinates from live selection inside the same editor.update
- Use nullable getCellNodeFromCords when out-of-grid moves are expected
When it happens
Trigger: selectTableNodeInDirection computing an out-of-bounds coordinate when moving a table-cell selection beyond the grid, or coordinate lookups against a stale TableDOMTable that no longer matches the current table.
Common situations: Programmatic table selection moved past the last row/column; table resized between selection update and lookup; tests driving direction commands without bounds clamping.
Related errors
- Cell not found at cords.
- Cell not found in table.
- Table Element Not Found
- Expected to find TableElement in DOM
- Expected TableNode.
AI-assisted analysis of BookStackApp/BookStack@18f8469a1c (2026-09-02).
Data as JSON: /api/errors/93139e30bf8996e9.
Report an issue: GitHub.