[BUG] Bash tool execution consistently fails with temporary script file error on macOS

Resolved 💬 8 comments Opened Jul 3, 2025 by HillTopTRPG Closed Jan 30, 2026

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.41 (Claude Code)
  • Operating System: macOS (Darwin 24.3.0)
  • Terminal: WebStorm

Bug Description

All Bash tool executions in Claude Code consistently fail with a "no such file or directory" error related to temporary script files. The error appears to be
related to Claude Code's internal mechanism for creating temporary script files when executing Bash commands.

Steps to Reproduce

  1. Open Claude Code in any project directory
  2. Attempt to execute any Bash command using the Bash tool (e.g., rm file.txt, npm run test, ls -la, etc.)
  3. Observe the consistent error message

Expected Behavior

Bash commands should execute normally and return their output or complete their operations successfully.

Actual Behavior

Every Bash command execution fails with the same error:
zsh:source:1: no such file or directory: /var/folders/7h/3tkbrsgj4w5801549byjrplw0000gn/T/claude-shell-snapshot-f7f2

The error occurs regardless of:

  • The specific command being executed
  • The command complexity (simple rm vs complex npm commands)
  • The target files or directories

Additional Context

  • Affected Tools: Only the Bash tool is affected
  • Working Tools: Read, Write, Edit, LS, Glob, Grep tools work normally
  • Workarounds: Using Task tool or alternative methods (Write tool for file deletion)
  • Error Pattern: The temporary file path remains consistent across different command attempts
  • Session Persistence: The issue persists throughout the entire Claude Code session

This appears to be a bug in Claude Code's internal temporary script file generation mechanism for Bash command execution.

View original on GitHub ↗

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