{"record":{"id":"333810cf505024ba","repo":"ianstormtaylor/slate","slug":"cannot-restore-point-because-saved-chunk-is-no-lon","errorCode":null,"errorMessage":"Cannot restore point because saved chunk is no longer connected to root","messagePattern":"Cannot restore point because saved chunk is no longer connected to root","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/slate-react/src/chunking/chunk-tree-helper.ts","lineNumber":399,"sourceCode":"    // pointer since it was saved, the index and index stack must be\n    // recomputed. This is slow, but this is fine since restoring a pointer is\n    // not a frequent operation.\n\n    const { chunk, node } = savedPointer\n    const index = chunk.children.indexOf(node)\n\n    // istanbul ignore next\n    if (index === -1) {\n      throw new Error(\n        'Cannot restore point because saved node is no longer in saved chunk'\n      )\n    }\n\n    const indexStack = this.getChunkPath(chunk)\n\n    // istanbul ignore next\n    if (!indexStack) {\n      throw new Error(\n        'Cannot restore point because saved chunk is no longer connected to root'\n      )\n    }\n\n    this.pointerChunk = chunk\n    this.pointerIndex = index\n    this.pointerIndexStack = indexStack\n    this.reachedEnd = false\n    this.cachedPointerNode = node\n    this.validateState()\n  }\n\n  /**\n   * Assuming the current node is a chunk, move the pointer into that chunk\n   *\n   * @param end If true, place the pointer on the last node of the chunk.\n   * Otherwise, place the pointer on the first node.\n   */","sourceCodeStart":381,"sourceCodeEnd":417,"githubUrl":"https://github.com/ianstormtaylor/slate/blob/72a37c701e5da4bb13a305d416d9c070d19d3a45/packages/slate-react/src/chunking/chunk-tree-helper.ts#L381-L417","documentation":"Internal invariant of slate-react's chunk tree helper: restorePointer() could not find a path from the saved chunk back to the root, meaning the chunk was detached from the tree between savePointer() and restorePointer(). Marked 'istanbul ignore next' — an internal bug, not caller error.","triggerScenarios":"Internal bug where insertAfter detaches the saved chunk before restoring the pointer; unreachable through documented APIs.","commonSituations":"Slate-react chunking bugs on very large documents; fork modifications that reparent chunks.","solutions":["Update slate-react","Report a minimal reproduction to the Slate maintainers","Refrain from mutating internal chunk structures in forks"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  applyOperations()\n} catch (e) {\n  if (e.message.includes('no longer connected to root')) {\n    // internal bug: fall back to a full re-render / remount\n  } else throw e\n}","preventionTips":["Stay on latest slate-react patches","Minimize batched structural edits to huge documents while bugs are unresolved"],"tags":["slate-react","chunking","internal-invariant","unreachable"],"backgroundTag":"library-internal-invariant","analyzedSha":"72a37c701e5da4bb13a305d416d9c070d19d3a45","analyzedAt":"2026-08-27T23:04:51.145Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}