Task tool: agent crashes with 'classifyHandoffIfNeeded is not defined'

Resolved 💬 2 comments Opened Feb 6, 2026 by leiha Closed Mar 6, 2026

Bug description

When using the Task tool with a custom subagent_type (defined via project configuration), the spawned agent intermittently crashes with:

classifyHandoffIfNeeded is not defined

This is not a one-off — it happens regularly across different conversations and agent types.

Steps to reproduce

  1. Configure custom agent types in the project (e.g., TX Architect)
  2. Spawn an agent via the Task tool with subagent_type set to a custom agent
  3. The agent starts working (makes several tool calls successfully)
  4. At some point, it crashes with the above error

Expected behavior

The agent completes its task without crashing on an internal runtime error.

Actual behavior

The agent fails with status failed and error classifyHandoffIfNeeded is not defined. The agent had already made progress (72 tool calls, 99K tokens) before the crash, confirming this is a runtime error in the agent orchestration layer, not a config issue.

Environment

  • Claude Code CLI (latest)
  • Model: claude-opus-4-6
  • OS: Linux (openSUSE Leap 16.0)
  • Custom subagent types configured via .claude/ project settings

Frequency

~10-20% of agent spawns with custom subagent types. Significant workflow disruption.

Workaround

Re-running the same task or falling back to manual tool calls.

View original on GitHub ↗

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