[BUG] Shell tool broken when using empty env file, bash gives syntax error, zsh swallows stdout

Resolved 💬 3 comments Opened Mar 30, 2026 by cantecim Closed May 6, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Environment

  • OS: Darwin 25.2.0 (macOS beta)
  • Claude Code: 2.1.87
  • Default shell: zsh (tested with both bash and zsh)

Behavior

With bash (/bin/bash):

Any command fails immediately:
/bin/bash: -c: line 1: syntax error: unexpected end of file

With zsh:

Commands run successfully but stdout is completely swallowed — no output received.

What Should Happen?

The Bash tool should execute shell commands and return their stdout/stderr output correctly, regardless of the user's default shell or macOS version.

Error Messages/Logs

Steps to Reproduce

  1. Create an empty env file to point to by CLAUDE_ENV_FILE
  2. Use the Bash tool or ! prefix with any command (e.g. echo a, ls)
  3. Observe the above errors

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.86

Claude Code Version

2.1.87

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

It is installed via homebrew, and it started to happen after upgrading to 2.1.87, and downgrading to 2.1.86 didn't help.

View original on GitHub ↗

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