BookStackApp/BookStack · error · Error
Cell not found at cords.
Error message
Cell not found at cords.
What it means
getDOMCellFromCordsOrThrow resolves grid coordinates to a DOM cell entry via getDOMCellFromCords, which returns null when (x, y) is outside the table or the cell has no DOM representation. This wrapper converts that null into a thrown Error('Cell not found at cords.').
Source
Thrown at resources/js/wysiwyg/lexical/table/LexicalTableNode.ts:259
const cell = row[index];
if (cell == null) {
return null;
}
return cell;
}
getDOMCellFromCordsOrThrow(
x: number,
y: number,
table: TableDOMTable,
): TableDOMCell {
const cell = this.getDOMCellFromCords(x, y, table);
if (!cell) {
throw new Error('Cell not found at cords.');
}
return cell;
}
getCellNodeFromCords(
x: number,
y: number,
table: TableDOMTable,
): null | TableCellNode {
const cell = this.getDOMCellFromCords(x, y, table);
if (cell == null) {
return null;
}
const node = $getNearestNodeFromDOMNode(cell.elem);
View on GitHub (pinned to 18f8469a1c)
Solutions
- Clamp/bounds-check x and y against tableNode.getRows()/getColumns() (or grid dimensions) before direction-based navigation.
- Refresh the table DOM data ($getElementForTableNode / getTable) before resolving coordinates after any mutation.
- Call the non-throwing getDOMCellFromCords and no-op when it returns null.
- Ensure the TableObserver re-reads the DOM after row/column changes so its cached grid matches reality.
Example fix
// before const cell = tableNode.getDOMCellFromCordsOrThrow(x, y, table); // throws off-grid // after const cell = tableNode.getDOMCellFromCords(x, y, table); if (!cell) return; // ignore navigation past table edge
Defensive patterns
Strategy: validation
Validate before calling
function inBounds(table: TableDOMTable, x: number, y: number): boolean {
return y >= 0 && y < table.rows.length && x >= 0 && x < (table.rows[y]?.cells.length ?? 0);
} Try / catch
try {
const cell = tableNode.getDOMCellFromCordsOrThrow(x, y, table);
} catch (e) {
if (e instanceof Error && e.message === 'Cell not found at cords.') return; // off-grid navigation
throw e;
} Prevention
- Clamp direction-based navigation targets to grid dimensions
- Refresh TableDOMTable via getTable after structural mutations
- Prefer the nullable getDOMCellFromCords in navigation code
When it happens
Trigger: adjustFocusNodeInDirection (keyboard arrow navigation inside a table selection) computing an (x, y) that is out of bounds — e.g. moving past the last row/column — or when the cached TableDOMTable is out of sync with the actual DOM.
Common situations: Arrow-key navigation at table edges with stale table measurements; tables modified concurrently (row removed while selection still references old coordinates); observer not yet re-synced after a DOM mutation.
Related errors
- Node at cords not TableCellNode.
- 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/651f62f807a9a8f4.
Report an issue: GitHub.