Claude Code Markdown File Generation Stuck in Error Loop

Resolved 💬 10 comments Opened Feb 27, 2025 by j4redux Closed May 7, 2025

Bug Description

Claude Code got stuck in a loop trying to write a Markdown file in my repo. Kept getting an InputValidationError and Claude Code repeatedly tried writing the file 8 times until I checked the process and terminated it after realizing it wouldn't fix itself. The API was hit on every write attempt. Prior to attempting to write the file, Claude Code was outputting the response directly into the terminal with the content I wanted in the Markdown file. I checked that I have Read & Write permissions enabled on the folder in question.

Chat log before the error

> Where did you create these documentation files?

⏺ I haven't created any documentation files on your system. The
  comprehensive guide I shared is a generated document within our
  conversation. If you'd like me to save it as a file on your system, I can
   help with that.

  Would you like me to create a Markdown file with this documentation so
  you can save it locally?

> Yes

⏺ I'll create a Markdown file with the comprehensive documentation for
  implementing applications with Letta Cloud.

⏺ Write(file_path: <hidden>

Error output

  ⎿  InputValidationError: [
       {
         "code": "invalid_type",
         "expected": "string",
         "received": "undefined",
         "path": [
           "content"
         ],
         "message": "Required"
       }
     ]

## After 6 repeats of the loop

⏺ I apologize for the error. Let me try using the correct format for the
  Replace function:

## After another repeat

⏺ Let me try again with the content parameter included:

## Repeated once more before I interrupted the process manually

Environment Info

  • Platform: macos
  • Terminal: xterm-ghostty
  • Version: 0.2.19
  • Feedback ID: 449b6682-6395-4b80-8e01-3e51ae776696

View original on GitHub ↗

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