ianstormtaylor/slate · error · Error
Cannot enter empty chunk
Error message
Cannot enter empty chunk
What it means
Internal invariant of slate-react's chunk tree helper: enterChunk() refuses to descend into a chunk with zero children because there would be no valid pointer position inside it. The branch is marked 'istanbul ignore next' — it guards against internal state corruption, since normal invariants prevent empty chunks from being entered.
Source
Thrown at packages/slate-react/src/chunking/chunk-tree-helper.ts:432
*
* @param end If true, place the pointer on the last node of the chunk.
* Otherwise, place the pointer on the first node.
*/
private enterChunk(end: boolean) {
// istanbul ignore next
if (this.pointerNode?.type !== 'chunk') {
throw new Error('Cannot enter non-chunk')
}
this.pointerIndexStack.push(this.pointerIndex)
this.pointerChunk = this.pointerNode
this.pointerIndex = end ? this.pointerSiblings.length - 1 : 0
this.cachedPointerNode = undefined
this.validateState()
// istanbul ignore next
if (this.pointerChunk.children.length === 0) {
throw new Error('Cannot enter empty chunk')
}
}
/**
* Assuming the current node is a chunk, move the pointer into that chunk
* repeatedly until the current node is a leaf
*
* @param end If true, place the pointer on the last node of the chunk.
* Otherwise, place the pointer on the first node.
*/
private enterChunkUntilLeaf(end: boolean) {
while (this.pointerNode?.type === 'chunk') {
this.enterChunk(end)
}
}
/**
* Move the pointer to the parent chunkView on GitHub (pinned to 72a37c701e)
Solutions
- Update slate-react
- Report an upstream issue with a reproduction
- Check fork code that empties chunk children arrays
Defensive patterns
Strategy: retry
Try / catch
try {
edit()
} catch (e) {
if (e.message === 'Cannot enter empty chunk') {
// internal bug: trigger a full reconciliation pass
} else throw e
} Prevention
- Update slate-react
- Ensure documents never contain structural anomalies like empty nested chunks
When it happens
Trigger: Internal bug or corrupted state leading to an empty chunk being entered during chunked rendering; not reachable via public APIs.
Common situations: Slate-react chunking regressions; forks that splice chunk children without maintaining invariants.
Related errors
- Cannot save pointer when pointerNode is null
- Cannot restore point because saved node is no longer in save
- Cannot restore point because saved chunk is no longer connec
- Cannot enter non-chunk
- Cannot exit root
AI-assisted analysis of ianstormtaylor/slate@72a37c701e (2026-08-27).
Data as JSON: /api/errors/f2304a3826cf3bb6.
Report an issue: GitHub.