Edit/Write tool should auto-read files instead of erroring

Resolved 💬 3 comments Opened Mar 29, 2026 by lionglan624-blip Closed Apr 1, 2026

Problem

The Edit and Write tools require that a file has been Read first, otherwise they fail with an error. When this happens, the model must:

  1. Attempt Edit → get error ("You must read the file before editing")
  2. Call Read on the file
  3. Re-attempt the Edit

This wastes 3 tool calls for what should be 1. It burns tokens, increases latency, and provides zero value to the user.

Expected Behavior

If the Edit/Write tool detects the file hasn't been read yet, it should automatically read it internally before applying the edit — not error out and force a round-trip.

The tool already knows which file is being edited. It already has the ability to read files. There is no reason to surface this as an error.

Prior Issues

  • #4230 (closed 2025-08-19) — "Write tool should auto-read files instead of requiring explicit read first"
  • #16546 (closed) — "Model attempts file edits without reading file first, wasting tokens and time"

Both were closed but the problem persists as of 2025-03 on Claude Opus 4.6. The underlying design issue (error instead of auto-read) was never addressed.

Impact

  • Token waste: 3 tool calls instead of 1, every time this occurs
  • Latency: Additional round-trips for no user benefit
  • User frustration: The system knows exactly what to do but refuses to do it

Environment

  • Claude Code version: latest (2025-03)
  • Model: Claude Opus 4.6
  • Platform: Windows 11

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗