-
Notifications
You must be signed in to change notification settings - Fork 15
E2BIG when launching Claude on Linux — --agents JSON exceeds 128KB per-argument kernel limit #797
Description
Description
il spin fails with spawn E2BIG on Linux when launching Claude because the total command-line arguments to claude exceed the kernel's ARG_MAX limit (2MB on Linux).
The launchClaude() function in src/utils/claude.ts passes the system prompt, MCP configs, agents JSON, and allowed tools list as CLI arguments via --append-system-prompt, --mcp-config, --agents, and --allowed-tools. When the system prompt is large (which is common with iloom's template system), the combined argument + environment size exceeds execve()'s limit.
Reproduction
- Set up a project with iloom on Linux
- Run
il start <issue-number>oril spinfrom a worktree - Observe
spawn E2BIGerror when Claude is launched
❌ Failed to spin up loom: Claude CLI error: Command failed with E2BIG: claude --model opus --permission-mode bypassPermissions --add-dir /path/to/worktree --add-dir /tmp --append-system-prompt <massive system prompt>...
This reproduces regardless of terminal backend (tested with tmux and direct invocation).
Root Cause
Linux execve() enforces ARG_MAX (typically 2MB) as the combined limit for arguments + environment. The system prompt alone can be very large, and combined with MCP configs, agents JSON, and tool lists, the total easily exceeds this limit.
On macOS, ARG_MAX is 1MB but the effective limit is stack_size/4 which is typically much larger (~16MB), so this issue may not manifest there.
Possible Solutions
- Write system prompt to a temp file: Use
--append-system-prompt-file <path>(if Claude CLI supports it) instead of inline - Pass large args via stdin: Pipe the configuration to Claude as JSON on stdin instead of CLI args
- Use environment variables: Store the system prompt in an env var (though this counts toward the same limit)
- Write a wrapper script: Generate a temp script with the full command and execute that
Environment
- Linux 6.8.0-90-generic (Ubuntu)
- iloom-cli v0.10.2
- Node.js v22.12.0
ARG_MAX: 2097152
Related
- PR feat: add Linux, WSL, and tmux terminal backends #796 (Linux terminal backend support) — this issue was discovered while testing Linux terminal backends
- Issue il start fails on Linux: terminal window launching not supported #795 (Linux support tracking)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status