{"record":{"id":"be0eb90fca6ee9f8","repo":"ianstormtaylor/slate","slug":"cannot-restore-point-because-saved-node-is-no-long","errorCode":null,"errorMessage":"Cannot restore point because saved node is no longer in saved chunk","messagePattern":"Cannot restore point because saved node is no longer in saved chunk","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/slate-react/src/chunking/chunk-tree-helper.ts","lineNumber":390,"sourceCode":"      this.pointerChunk = this.root\n      this.pointerIndex = -1\n      this.pointerIndexStack = []\n      this.reachedEnd = false\n      this.cachedPointerNode = undefined\n      return\n    }\n\n    // Since nodes may have been inserted or removed prior to the saved\n    // 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","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/ianstormtaylor/slate/blob/72a37c701e5da4bb13a305d416d9c070d19d3a45/packages/slate-react/src/chunking/chunk-tree-helper.ts#L372-L408","documentation":"Internal invariant of slate-react's chunk tree helper: restorePointer() found that the node captured in a SavedPointer is no longer a child of the chunk it was saved in. Marked 'istanbul ignore next', meaning it indicates an internal bug (state mutated between save and restore) rather than caller misuse.","triggerScenarios":"Internal bug during insertAfter where the saved node is removed from its chunk before the pointer is restored; not reachable via public APIs.","commonSituations":"A slate-react chunking regression on large documents; custom forks that mutate chunk trees directly.","solutions":["Upgrade slate-react to the newest version","File a Slate issue with a reproduction if it persists","Avoid any direct manipulation of internal chunk tree structures"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  performEdit()\n} catch (e) {\n  if (e.message.includes('no longer in saved chunk')) {\n    // internal bug: force full re-render instead of chunked update\n  } else throw e\n}","preventionTips":["Update slate-react when chunking bugs are reported","Avoid mutating internal chunk structures"],"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"}