Skip to content

Conversation

@greg12579
Copy link

Summary

  • Fixes agent crash on Windows when prompts exceed ~8191 character command line limit
  • Prompts over 7000 characters are now passed via stdin instead of CLI argument
  • Maintains compatibility with Claude Code's --print mode which accepts stdin input

Problem

On Windows, the command line has a length limit of ~8191 characters. When the wizard builds up conversation history, the prompt can exceed this limit, causing the agent process to fail immediately with exit code 1 and no output.

Symptoms:

  • "Agent exited with code 1" error on second or subsequent wizard messages
  • Process spawns but exits within ~30ms
  • No error output from the agent itself

Solution

Detect when a prompt exceeds 7000 characters (leaving margin for command and args) on Windows, and instead of passing it as a CLI argument, write it to the process's stdin. Claude Code's --print mode accepts prompts via stdin, so this maintains compatibility.

Test plan

  • First wizard message works (prompt under limit)
  • Second wizard message works (prompt over limit, uses stdin)
  • Verify other agents still work normally
  • Test on macOS/Linux (should be unaffected)

🤖 Generated with Claude Code

Windows has a command line length limit of ~8191 characters. When
prompts exceed this limit (e.g., wizard with conversation history),
the agent process fails immediately with exit code 1.

This fix detects prompts over 7000 characters on Windows and passes
them via stdin instead of as a command line argument, avoiding the
limit while maintaining compatibility with Claude Code's --print mode.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant