Agent invocation crashes with 'Internal tools error' when subagent Bash command contains 2>&1 redirect (Windows Git Bash, v2.1.89)

Resolved 💬 2 comments Opened Apr 2, 2026 by copperspeed Closed May 10, 2026

Environment

  • Claude Code version: 2.1.89
  • OS: Windows 11 Home
  • Shell: Git Bash

Description

Invoking a custom subagent (defined in .claude/agents/) fails with \"Internal tools error during invocation of <agent-name>\" when the agent attempts to run a Bash command containing a 2>&1 redirect.

The error appears as [Tool result missing due to internal error] in the agent and surfaces as \"Internal tools error\" to the user. Instead of prompting for approval or returning an error message, the Bash tool crashes entirely.

Steps to Reproduce

  1. Define a custom agent in .claude/agents/playwright-writer.md with Bash in the tools list
  2. Invoke the agent via the Agent tool
  3. Agent runs a Bash command with 2>&1 redirect, e.g.:

``
npm --prefix playwright run test:j0 2>&1
``

  1. Observe: [Tool result missing due to internal error] — agent crashes, no output returned

Expected Behavior

Either:

  • The command runs and returns output, or
  • An approval prompt appears (consistent with how other restricted commands are handled), or
  • A clear error message is returned explaining why the command was blocked

Actual Behavior

The Bash tool crashes with an internal error. No output is returned. The agent cannot continue.

Additional Context

  • The CLAUDE.md for this project explicitly prohibits 2>&1 redirects because \"compound commands, pipes, and redirects break permission matching\" — but the expected behavior was a prompt, not a crash
  • After a session restart the agent invocation succeeded once (when no 2>&1 was present), confirming the crash is specific to the redirect syntax
  • The agent definition uses Skill(playwright-best-practices) and Skill(playwright-cli) in the tools list — unclear if this contributes to the crash
  • Workaround: explicitly prohibit 2>&1 in the agent definition so the agent never generates it

View original on GitHub ↗

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