[BUG] Task collects data but never writes file, CPU spikes to 100%

Resolved 💬 5 comments Opened Nov 13, 2025 by warlord0 Closed Jan 17, 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?

When I ask Claude Code to write a chapter of text, it uses my MCP to fetch data, then fails to write the chapter. I know it has the chapter because if I open the file ~/.claude/projects/-home-xxxx-tmp/34b6bdb6-a5b1-4959-aa1f-139a0f07ad2b.jsonl I can see the full chapter changes it has written in the JSON:

  "uuid": "52850ee5-3f84-4f27-ad6c-47636ae27397",
  "timestamp": "2025-11-13T08:45:19.205Z",
  "toolUseResult": {
    "filePath": "/home/xxxx/tmp/book4_chapter12_rewrite.md",
    "oldString": "\"Bruised,\" she said. \"I'll live. We need to move.\"\n\nThey moved.\n\n",
    "newString":

What Should Happen?

It should make the changes to the output file contained in newString

Error Messages/Logs

I got Claude on this, and it came back with:

The debug log shows a pattern of timeouts: "Timed out waiting for first result, closing input stream" repeated multiple times. This indicates Claude Code is getting stuck in a loop waiting for responses. Looking at your JSONL file, I can see the actual issue - the previous session was trying to write a Chapter 9 rewrite and got stuck. The last tool use shows it was about to use the Read tool but then never completed the write operation. Root cause: This appears to be an issue where Claude Code's file writing is getting blocked, likely due to:

Large context/token usage - The session accumulated a lot of context from Novel Codex queries
A timeout loop - The system is repeatedly timing out and retrying
The Write tool never being invoked - The data is collected but never written

What you should do:

Report this as a bug at https://github.com/anthropics/claude-code/issues with:
The session ID: 317bc8a2-8837-46b0-a456-690d7d026d46
The debug log showing timeout loops
Mention: Task collects data but never writes file, CPU spikes to 100%

Immediate workaround - Instead of asking Claude Code to write a complete chapter rewrite in one go, break it down:
Ask it to read the original chapter first
Then ask it to write just a section at a time
Or ask it to write the full chapter but limit the context (fewer style guide lookups)

Steps to Reproduce

This is the prompt I used:

"We're in the process of rewriting Real Hero, Book 4 using out new style and mturity guide. You can get details of the guides, chapters, and characters from the mcp novel-codex. You should query for details before attempting to rewrite the chapter. Currently we are working on rewriting chapter 9."

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.37 (Claude Code)

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

VS Code integrated terminal

Additional Information

It's using an MCP server I have written that uses my API to my Novel Codex - another self written software, that searches for content using API calls to FastAPI to query a database.

View original on GitHub ↗

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