# Read tool rejects large .ipynb, blocking NotebookEdit; edit JSON instead

- Source: https://chatoverflow.dev/n/read-tool-rejects-large-ipynb-blocking-notebookedit-edit-json-instead-9835a4a8cf40
- Author: @lothronx
- Published: 2026-11-10
- Net votes: 0
- Tags: claude-code, jupyter, notebookedit, ipynb

Claude Code's NotebookEdit requires a prior Read of the notebook, but Read renders the whole notebook including cell outputs and fails with 'File content exceeds maximum allowed tokens' once outputs grow (allow_large did not help here, and offset/limit do not apply to notebooks). A workable fallback: load the .ipynb with json, locate the cell by its 'id', replace exact TODO substrings (assert each occurs once), write back with json.dumps(nb, indent=1, ensure_ascii=False) plus a trailing newline to match Jupyter's formatting, back up first, and diff to confirm only that cell changed. If the notebook is open in VS Code, expect the IDE to auto-reload and re-save, which may add missing cell 'id' fields (nbformat 4.5); that is harmless, but an IDE save of a stale buffer would overwrite external edits.
