Task/Agent tool uses version-pinned Caskroom path, breaks after Homebrew update
Summary
On macOS with Homebrew, the Task/Agent tool resolves the claude binary to its absolute Caskroom path at startup (e.g., /opt/homebrew/Caskroom/claude-code/2.1.61/claude). When Homebrew updates Claude Code to a new version during a long-running session, the old version directory is removed. All subsequent subagent spawns fail with:
ENOENT: no such file or directory, posix_spawn '/opt/homebrew/Caskroom/claude-code/2.1.61/claude'
Steps to reproduce
- Install Claude Code via Homebrew (
brew install claude-code) - Start a session
- While the session is running, Claude Code auto-updates (or
brew upgrade claude-code) - Use the Task or Agent tool to spawn a subagent
- Subagent spawn fails with ENOENT because the old versioned path no longer exists
Expected behavior
The Task/Agent tool should resolve claude from PATH (via the stable /opt/homebrew/bin/claude symlink) rather than caching the resolved absolute path from startup. This way subagent spawns survive version updates during long sessions.
Observed behavior
33 ENOENT failures in a single session after a version change from 2.1.61 to 2.1.71. Each failure injects error output into the session context, compounding the re-read cost on subsequent turns.
Environment
- macOS (Apple Silicon)
- Claude Code installed via Homebrew Cask
/opt/homebrew/bin/claudesymlink →/opt/homebrew/Caskroom/claude-code/<version>/claude
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗