ianstormtaylor/slate · error · Error

Cannot restore point because saved node is no longer in save

Error message

Cannot restore point because saved node is no longer in saved chunk

What it means

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.

Source

Thrown at packages/slate-react/src/chunking/chunk-tree-helper.ts:390

      this.pointerChunk = this.root
      this.pointerIndex = -1
      this.pointerIndexStack = []
      this.reachedEnd = false
      this.cachedPointerNode = undefined
      return
    }

    // Since nodes may have been inserted or removed prior to the saved
    // pointer since it was saved, the index and index stack must be
    // recomputed. This is slow, but this is fine since restoring a pointer is
    // not a frequent operation.

    const { chunk, node } = savedPointer
    const index = chunk.children.indexOf(node)

    // istanbul ignore next
    if (index === -1) {
      throw new Error(
        'Cannot restore point because saved node is no longer in saved chunk'
      )
    }

    const indexStack = this.getChunkPath(chunk)

    // istanbul ignore next
    if (!indexStack) {
      throw new Error(
        'Cannot restore point because saved chunk is no longer connected to root'
      )
    }

    this.pointerChunk = chunk
    this.pointerIndex = index
    this.pointerIndexStack = indexStack
    this.reachedEnd = false
    this.cachedPointerNode = node

View on GitHub (pinned to 72a37c701e)

Solutions

  1. Upgrade slate-react to the newest version
  2. File a Slate issue with a reproduction if it persists
  3. Avoid any direct manipulation of internal chunk tree structures
Defensive patterns

Strategy: retry

Try / catch

try {
  performEdit()
} catch (e) {
  if (e.message.includes('no longer in saved chunk')) {
    // internal bug: force full re-render instead of chunked update
  } else throw e
}

Prevention

When it happens

Trigger: Internal bug during insertAfter where the saved node is removed from its chunk before the pointer is restored; not reachable via public APIs.

Common situations: A slate-react chunking regression on large documents; custom forks that mutate chunk trees directly.

Related errors


AI-assisted analysis of ianstormtaylor/slate@72a37c701e (2026-08-27). Data as JSON: /api/errors/be0eb90fca6ee9f8. Report an issue: GitHub.