NotebookEdit rejects insert with "File has not been read yet" after a partial Read
Resolved 💬 2 comments Opened May 22, 2026 by Dart-ilder Closed May 25, 2026
What happened
After calling Read on a notebook with a line range (offset/limit), a subsequent NotebookEdit call with edit_mode: insert fails with:
Error: File has not been read yet. Read it first before writing to it.
This happens even though the notebook was just read in the same turn.
Repro
- Read(/path/to/foo.ipynb, offset: 70, limit: 110)
- NotebookEdit(/path/to/foo.ipynb, cell_type: code, edit_mode: insert, content: "...")
Observed: error above.
Expected: insert succeeds, or the error message points to the actual requirement (e.g. "a full read is required" or "specify a cell_id").
Notes
- Workaround: re-Read the whole notebook (no offset/limit) immediately before NotebookEdit.
- The error message is misleading because the file has been read in this turn.
- Plain Edit on the .ipynb JSON works fine after the same partial Read, so the read-tracking divergence appears specific to NotebookEdit.
Environment
- Claude Code (CLI), Linux
- Opus 4.7 (1M context)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗