[BUG] E2BIG Error in Bash Tool

Status Fixed / completed
Maintainer reply None cached
Activity 11 comments · opened Jul 17, 2025 · closed Jul 17, 2025

Bug Description
Claude gets these errors when trying to rm files/folders, but if i execute them it works

● Bash(find /home/newt/Luninora/backend/tests -name "*.test.ts" -type f -exec rm {} \;)
  ⎿  Error: spawn E2BIG

● Bash(rm -rf /home/newt/Luninora/backend/tests/services)
  ⎿  Error: spawn E2BIG

● Bash(rm -rf /home/newt/Luninora/backend/tests/integration)
  ⎿  Error: spawn E2BIG

● Bash(rm -rf /home/newt/Luninora/backend/tests/*)
  ⎿  Error: spawn E2BIG

Environment Info

  • Platform: linux
  • Terminal: vscode
  • Version: 1.0.54
  • Feedback ID: 9f41e0ec-a69d-4a7a-b828-4a11d04fe7a2

Errors

[{"error":"Error: Request was aborted.\n    at c$.makeRequest (file:///home/newt/.bun/install/global/node_modules/@anthropic-ai/claude-code/cli.js:1199:3840)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-07-17T12:43:25.853Z"}]

View original on GitHub ↗

11 Comments

NewtTheWolf · 1 year ago

Claude Code Bug Report: E2BIG Error in Bash Tool

Summary

The Bash tool in Claude Code consistently fails with spawn E2BIG error for all commands, regardless of complexity.

Environment

  • Platform: Linux
  • OS Version: Linux 5.15.0-142-generic
  • Working Directory: /home/newt/Luninora
  • Git Repository: No
  • Date: 2025-07-17
  • Claude Model: claude-sonnet-4-20250514

Issue Description

All Bash tool invocations fail with spawn E2BIG error, including the simplest commands like echo "test", whoami, and date. The error occurs immediately upon tool invocation, suggesting an environment-related issue rather than command-specific problems.

Steps to Reproduce

  1. Open Claude Code in any directory
  2. Attempt to run any Bash command using the Bash tool
  3. Error occurs consistently across all commands

Commands Tested (All Failed)

# Simple commands
echo "test"
whoami 
date
pwd
ls

# Directory operations
mkdir -p tests/unit/services/manager
mkdir tests

# All return: spawn E2BIG

Expected Behavior

Bash commands should execute successfully and return expected output.

Actual Behavior

All Bash tool invocations fail with:

spawn E2BIG

Workarounds Used

  • Used Write tool to create files (automatically creates directory structure)
  • Used LS, Read, Grep, Glob tools for file operations
  • Manual execution by user works normally

Technical Analysis

The E2BIG error typically indicates:

  • Environment variables are too large
  • Command line arguments exceed system limits
  • Combined size of environment + arguments exceeds ARG_MAX

Since even minimal commands fail, the issue appears to be with the Bash tool's environment setup rather than specific command execution.

Impact

  • Cannot use Bash tool for any shell operations
  • Must rely on alternative tools or manual user execution
  • Limits automation capabilities for development workflows

Additional Context

  • User can execute identical commands manually without issues
  • Problem is specific to Claude Code's Bash tool implementation
  • Other Claude Code tools (Read, Write, LS, etc.) work normally
  • Issue persists across different working directories

System Information

This may be relevant for debugging the environment setup:

  • The system appears to be a standard Linux environment
  • No unusual PATH or environment variable configurations reported by user
  • Issue is reproducible and consistent

Request

Please investigate the Bash tool's environment setup and process spawning mechanism to identify why all commands fail with E2BIG error.

josantonius · 1 year ago

Same issue — any Bash command executed via ! blocks results in a spawn E2BIG error.

Error: Bash command failed for pattern "!git status": [stderr] spawn E2BIG

Environment Info

  • Platform: Linux
  • Terminal: VS Code | Cursor
  • Version: 1.0.54
  • Feedback ID: 69806a29-5b48-425d-a35a-5fe0181c7cf2
jms90h5 · 1 year ago

I just started getting the same issue. Restarting the shell and a new Claude code session didn't help. Claude told me this: - Basic commands like pwd and ls fail with "spawn E2BIG"

  • Issue persists across new shells and sessions
  • Direct bash execution works fine (getconf ARG_MAX

shows 2097152)

  • Other tools (Read, Write, etc.) work normally
  • Environment variables are normal (55 vars, 4768 chars)
  • Error suggests tool-level issue, not system-level
ivan-velikanov · 1 year ago

I am also facing the same issue; restarted wsl, windows, claude nothing is working. Bash commands are not working. Other commands like Write, Read etc are fine. Even Bash(ls) type simple commands are not working.

herculan0 · 1 year ago

Was facing the same issue, looks like 1.0.54 was broken. They revert to 1.0.53

claude update
fixed the issue

NewtTheWolf · 1 year ago

Works for me too, thanks @herculan0

jms90h5 · 1 year ago

Interesting. Claude update works for me also, however it says I'm now using 1.0.54

NewtTheWolf · 1 year ago

Okey thats weird, for me its 1.0.53 🤔 and another update says that 53 is the newest one

danielbowne · 1 year ago

same issue, did an upgrade and it rolled back and working again.

Current version: 1.0.54
Checking for updates...
npm info using npm@10.8.2
npm info using node@v18.20.8
npm info ok
New version available: 1.0.53 (current: 1.0.54)
Installing update...
Using local installation update method...
Successfully updated from 1.0.54 to version 1.0.53

ivan-velikanov · 1 year ago
$ claude update
Current version: 1.0.54
Checking for updates...
New version available: 1.0.53 (current: 1.0.54)
Installing update...
Using local installation update method...
Successfully updated from 1.0.54 to version 1.0.53
github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.