Task/Agent tool uses version-pinned Caskroom path, breaks after Homebrew update

Resolved 💬 2 comments Opened Mar 9, 2026 by ppiankov Closed Apr 6, 2026

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

  1. Install Claude Code via Homebrew (brew install claude-code)
  2. Start a session
  3. While the session is running, Claude Code auto-updates (or brew upgrade claude-code)
  4. Use the Task or Agent tool to spawn a subagent
  5. 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/claude symlink → /opt/homebrew/Caskroom/claude-code/<version>/claude

View original on GitHub ↗

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