Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Dec 2, 2025

This PR fixes issue #9759 where the Claude Code provider crashes with an E2BIG error when Codebase Indexing is active.

Problem

When Codebase Indexing is enabled, the system prompt becomes very large and exceeds the OS ARG_MAX limit (typically ~128KB on Linux/Mac) when passed as a command-line argument, causing a spawn E2BIG error.

Solution

Modified the runProcess function to always pass the system prompt via stdin on all platforms, not just Windows. This prevents the E2BIG error by avoiding command-line argument size limits.

Changes Made:

  • Modified src/integrations/claude-code/run.ts to always pass system prompt via stdin
  • Updated tests in src/integrations/claude-code/__tests__/run.spec.ts to reflect the new unified behavior
  • All existing tests pass

Technical Details:

  • Previously: Windows used stdin for system prompt (to avoid cmd.exe 8191 char limit), while Linux/Mac used command-line arguments
  • Now: All platforms use stdin for both system prompt and messages
  • This approach avoids both Windows cmd.exe limits and Linux/Mac ARG_MAX limits

Fixes #9759


Important

Fix E2BIG error in Claude Code provider by passing system prompt via stdin on all platforms.

  • Behavior:
    • Modify runProcess in run.ts to pass system prompt and messages via stdin on all platforms, preventing E2BIG errors.
    • Update run.spec.ts tests to ensure system prompt is not passed as a command-line argument on any platform.
  • Error Handling:
    • Enhance error handling in run.ts for ENOENT errors with createClaudeCodeNotFoundError().
    • Ensure graceful handling of stdin write and access errors in run.ts.
  • Testing:
    • Update run.spec.ts to test stdin behavior across platforms and error scenarios.
    • Ensure tests cover both Windows and non-Windows platforms for consistent behavior.

This description was created by Ellipsis for e76d64f. You can customize this summary. It will automatically update as commits are pushed.

…stem prompt via stdin

- Modified runProcess to always pass system prompt via stdin on all platforms
- Previously only Windows used stdin for system prompt to avoid cmd.exe limits
- Now all platforms use stdin to avoid Linux/Mac ARG_MAX limits (~128KB)
- This fixes crashes when using Claude Code with Codebase Indexing active
- Updated tests to reflect the new unified behavior

Fixes #9759
@roomote roomote bot requested review from cte, jr and mrubens as code owners December 2, 2025 22:47
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Dec 2, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Dec 2, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

The fix correctly addresses the E2BIG error by passing both system prompt and messages via stdin on all platforms, avoiding command-line argument size limits. The implementation is well-tested with comprehensive coverage of error scenarios and platform-specific behavior.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[BUG] spawn E2BIG when Claude Claude is used with Codebase Indexing active (ARG_MAX exceeded)

3 participants