[BUG] `pipefail` not enabled in Bash tool, which sometimes tricks claude

Resolved 💬 3 comments Opened Dec 4, 2025 by aster-void Closed Feb 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?

The Bash tool does not have set -o pipefail enabled. This causes failures in piped commands to be silently ignored, as only the exit code of the last command in the pipeline is checked.

Why this is wrong

curl -S http://localhost:9999 2>&1 | wc -c

Even if curl fails (connection refused), wc -c succeeds with exit code 0 and outputs 402 (in my environment).
LLMs see exit code 0 and concludes "server returned 402 bytes" instead of "connection failed".

What Should Happen?

When a command in a pipeline fails, the entire pipeline should fail. This is standard defensive shell scripting practice. The Bash tool should run with set -o pipefail enabled.

fyi the combination set -euo pipefail is called strict mode and is recommended to use most of the time.

Error Messages/Logs

Steps to Reproduce

claude 'run curl -S http://localhost:9999 2>&1 | wc -c'

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.55 (Claude Code) # I checked it works in latest release as well

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

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