BookStackApp/BookStack · error · Error
TableMap Error: Attempted to get cell ${position+1} of ${thi
Error message
TableMap Error: Attempted to get cell ${position+1} of ${this.cells.length} What it means
Bounds guard in TableMap.getCellAtPosition: the computed (y*columnCount)+x position is >= the filled cell list length, i.e. a lookup ran past the table map's known cells — usually after the map went stale relative to the actual table DOM/nodes. Input at fault: x/y coordinates outside the mapped grid.
Source
Thrown at resources/js/wysiwyg/utils/table-map.ts:79
let lastCell: TableCellNode = rowsAndCells[0][0];
for (let y = 0; y < this.rowCount; y++) {
for (let x = 0; x < this.columnCount; x++) {
if (!rowsAndCells[y] || !rowsAndCells[y][x]) {
cells.push(lastCell);
} else {
cells.push(rowsAndCells[y][x]);
lastCell = rowsAndCells[y][x];
}
}
}
this.cells = cells;
}
public getCellAtPosition(x: number, y: number): TableCellNode {
const position = (y * this.columnCount) + x;
if (position >= this.cells.length) {
throw new Error(`TableMap Error: Attempted to get cell ${position+1} of ${this.cells.length}`);
}
return this.cells[position];
}
public getCellsInRange(range: CellRange): TableCellNode[] {
const minX = Math.max(Math.min(range.fromX, range.toX), 0);
const maxX = Math.min(Math.max(range.fromX, range.toX), this.columnCount - 1);
const minY = Math.max(Math.min(range.fromY, range.toY), 0);
const maxY = Math.min(Math.max(range.fromY, range.toY), this.rowCount - 1);
const cells = new Set<TableCellNode>();
for (let y = minY; y <= maxY; y++) {
for (let x = minX; x <= maxX; x++) {
cells.add(this.getCellAtPosition(x, y));
}
}View on GitHub (pinned to 18f8469a1c)
Solutions
- Rebuild the TableMap from the current table DOM before cell lookups
- Clamp x/y to rowCount-1/columnCount-1 before calling getCellAtPosition
- Check the callers (relCell, getCellsInRange, headCell) use valid in-range coordinates
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at resources/js/wysiwyg/utils/table-map.ts:79 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/af36cbd5aa0521e0.
Report an issue: GitHub.