[BUG] Write tool fails with "internal error" on large file writes, consuming context quota without producing output

Resolved 💬 3 comments Opened Feb 24, 2026 by indragunawangermany-stack Closed Feb 28, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Description:
When attempting to write a large file (~400+ lines of markdown) using the Write tool, the tool fails silently with "Tool result missing due to internal error." The failure consumes a full context turn (and associated quota) without creating the file.

Steps to reproduce:

Ask Claude Code to write a large file (>400 lines) in a single Write tool call
The Write tool executes, appears to hang, then returns an internal error
The file is not created
The full context turn is consumed regardless
Expected behavior: Either the file is written successfully, or the error is returned without consuming the turn's context quota.

Actual behavior: Tool fails with internal error, file not created, full context consumed. Retrying produces the same error, consuming additional quota.

Impact: Lost approximately 17% of weekly quota across two failed attempts before the session context was exhausted.

Environment:

Claude Code CLI
Model: claude-opus-4-6
OS: Linux 4.4.0
Task: Writing a single large markdown file (~400+ lines)
Workaround found: Writing the file in a subsequent session using the same content succeeded. The issue appears to be related to very large single Write calls within a context-heavy session.

What Should Happen?

it should works :-)

Error Messages/Logs

Steps to Reproduce

Description:
When attempting to write a large file (~400+ lines of markdown) using the Write tool, the tool fails silently with "Tool result missing due to internal error." The failure consumes a full context turn (and associated quota) without creating the file.

Steps to reproduce:

Ask Claude Code to write a large file (>400 lines) in a single Write tool call
The Write tool executes, appears to hang, then returns an internal error
The file is not created
The full context turn is consumed regardless
Expected behavior: Either the file is written successfully, or the error is returned without consuming the turn's context quota.

Actual behavior: Tool fails with internal error, file not created, full context consumed. Retrying produces the same error, consuming additional quota.

Impact: Lost approximately 17% of weekly quota across two failed attempts before the session context was exhausted.

Environment:

Claude Code CLI
Model: claude-opus-4-6
OS: Linux 4.4.0
Task: Writing a single large markdown file (~400+ lines)
Workaround found: Writing the file in a subsequent session using the same content succeeded. The issue appears to be related to very large single Write calls within a context-heavy session.

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

latest

Platform

Other

Operating System

Windows

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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