{"record":{"id":"696232a2c87027f3","repo":"ianstormtaylor/slate","slug":"cannot-enter-non-chunk","errorCode":null,"errorMessage":"Cannot enter non-chunk","messagePattern":"Cannot enter non-chunk","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/slate-react/src/chunking/chunk-tree-helper.ts","lineNumber":421,"sourceCode":"\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   */\n  private enterChunk(end: boolean) {\n    // istanbul ignore next\n    if (this.pointerNode?.type !== 'chunk') {\n      throw new Error('Cannot enter non-chunk')\n    }\n\n    this.pointerIndexStack.push(this.pointerIndex)\n    this.pointerChunk = this.pointerNode\n    this.pointerIndex = end ? this.pointerSiblings.length - 1 : 0\n    this.cachedPointerNode = undefined\n    this.validateState()\n\n    // istanbul ignore next\n    if (this.pointerChunk.children.length === 0) {\n      throw new Error('Cannot enter empty chunk')\n    }\n  }\n\n  /**\n   * Assuming the current node is a chunk, move the pointer into that chunk\n   * repeatedly until the current node is a leaf\n   *","sourceCodeStart":403,"sourceCodeEnd":439,"githubUrl":"https://github.com/ianstormtaylor/slate/blob/72a37c701e5da4bb13a305d416d9c070d19d3a45/packages/slate-react/src/chunking/chunk-tree-helper.ts#L403-L439","documentation":"Internal invariant of slate-react's chunk tree helper: enterChunk() requires the current pointer node to be of type 'chunk' before descending into it. It is only called from enterChunkUntilLeaf after checking the node type, so reaching this throw means internal state is inconsistent (an 'istanbul ignore next' defensive branch).","triggerScenarios":"Internal library bug or corrupted chunk-tree state; not producible through the public slate-react API.","commonSituations":"Buggy slate-react versions with chunking regressions; direct manipulation of internal chunk state in forks.","solutions":["Upgrade slate-react to the latest version","Report the bug upstream with a reproduction","Audit any local changes to chunk-tree-helper call sites"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  edit()\n} catch (e) {\n  if (e.message === 'Cannot enter non-chunk') {\n    // internal bug: remount the editor as recovery\n  } else throw e\n}","preventionTips":["Keep slate-react current","Reproduce and report internal invariant throws upstream"],"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"}