{"record":{"id":"17a3a9c8ba99b390","repo":"BookStackApp/BookStack","slug":"expected-table-cell-to-be-inside-of-table-row","errorCode":null,"errorMessage":"Expected table cell to be inside of table row.","messagePattern":"Expected table cell to be inside of table row\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts","lineNumber":103,"sourceCode":"  const node = $findMatchingParent(startingNode, (n) => $isTableCellNode(n));\n\n  if ($isTableCellNode(node)) {\n    return node;\n  }\n\n  return null;\n}\n\nexport function $getTableRowNodeFromTableCellNodeOrThrow(\n  startingNode: LexicalNode,\n): TableRowNode {\n  const node = $findMatchingParent(startingNode, (n) => $isTableRowNode(n));\n\n  if ($isTableRowNode(node)) {\n    return node;\n  }\n\n  throw new Error('Expected table cell to be inside of table row.');\n}\n\nexport function $getTableNodeFromLexicalNodeOrThrow(\n  startingNode: LexicalNode,\n): TableNode {\n  const node = $findMatchingParent(startingNode, (n) => $isTableNode(n));\n\n  if ($isTableNode(node)) {\n    return node;\n  }\n\n  throw new Error('Expected table cell to be inside of table.');\n}\n\nexport function $getTableRowIndexFromTableCellNode(\n  tableCellNode: TableCellNode,\n): number {\n  const tableRowNode = $getTableRowNodeFromTableCellNodeOrThrow(tableCellNode);","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/BookStackApp/BookStack/blob/18f8469a1c72f8cc8497e9372635e6dea5028071/resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts#L85-L121","documentation":"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.","triggerScenarios":"Thrown at resources/js/wysiwyg/lexical/table/LexicalTableUtils.ts:103 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"18f8469a1c72f8cc8497e9372635e6dea5028071","analyzedAt":"2026-09-02T19:49:33.068Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}