facebook/lexical · error
Cell not found at cords.
Error message
Cell not found at cords.
What it means
This method (getDOMCellOrThrow-style accessor) delegates to getDOMCellFromCords and throws 'Cell not found at cords.' when the coordinate lookup returns null — i.e. the given x/y does not point at a real cell in the DOM table representation. Coordinates outside the table bounds, or a DOM table snapshot that no longer matches the node tree, produce this error.
Source
Thrown at packages/lexical-table/src/LexicalTableNode.ts:757
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 76a22dcba9)
Solutions
- Clamp/validate x and y against table.getCordsFromCell / table size before lookup
- Re-read the DOM table (table.getDOMCellFromCords with a fresh TableDOMTable) inside the current update
- Null-check via getDOMCellFromCords directly instead of the throwing wrapper when out-of-bounds is expected
Example fix
// before
const cell = table.getDOMCellAtCords(x, y, domTable); // throws at edges
// after
const cell = table.getDOMCellFromCords(x, y, domTable);
if (cell) { /* handle */ } else { /* outside table: ignore */ } Defensive patterns
Strategy: validation
Validate before calling
const rows = table.getRowCount(); // or derive from domTable if (x < 0 || y < 0 || x >= columns || y >= rows) return; // outside table const cell = table.getDOMCellFromCords(x, y, domTable); // null-checked instead of throwing
Type guard
function cellAt(domTable: TableDOMTable, x: number, y: number): TableDOMCell | null {
return domTable.rows[y]?.cells?.[x] ?? null;
} Try / catch
try {
const cell = table.getDOMCellAtCords(x, y, domTable);
} catch (e) {
if (String(e).includes('Cell not found at cords')) {
// coordinates outside table or stale DOM snapshot — recompute
} else { throw e; }
} Prevention
- Use the non-throwing getDOMCellFromCords when out-of-range is a normal case
- Recompute TableDOMTable inside the event's update, never cache it
- Clamp hit-test coordinates from mouse math to table bounds
When it happens
Trigger: Calling it with x/y beyond the table's row/column count; passing a TableDOMTable captured before rows/columns were removed by another update; mouse handlers computing coordinates from stale DOM rects.
Common situations: Custom table selection plugins doing hit-testing at table edges; drag handlers firing after a column/row deletion re-rendered the table; off-by-one coordinates from getBoundingClientRect math.
Related errors
- Cell not found in table.
- Node at cords not TableCellNode.
- ${method} is not supported in headless mode
- CodeHighlightPlugin: CodeNode or CodeHighlightNode not regis
- CodeHighlightPlugin: CodeNode or CodeHighlightNode not regis
AI-assisted analysis of facebook/lexical@76a22dcba9 (2026-08-31).
Data as JSON: /api/errors/87b5af1534a59995.
Report an issue: GitHub.