Task() subagent fails intermittently with 'classifyHandoffIfNeeded is not defined'

Resolved 💬 3 comments Opened Feb 25, 2026 by danielnolle Closed Mar 1, 2026

Description

When launching subagents via Task() (concurrent isolated agents), the call intermittently fails with:

classifyHandoffIfNeeded is not defined

The error occurs before the agent's own code executes - it's in the Claude Code agent runtime bootstrap.

Reproduction

  1. Launch two Task() calls in parallel (same message, concurrent execution)
  2. Both agents fail with classifyHandoffIfNeeded is not defined
  3. Retry the same calls → both succeed on second attempt

Context

  • Platform: Windows 11
  • Trigger: Parallel Task() calls with custom subagent_type (skill-based agents)
  • Frequency: Intermittent (not every time, but reproducible across sessions)
  • Workaround: Retry succeeds reliably on second attempt

Expected Behavior

Task() calls should succeed on first invocation without requiring retries.

Actual Behavior

First invocation fails with classifyHandoffIfNeeded is not defined. The function appears to not be defined/imported in certain execution contexts, possibly related to parallel agent initialization timing.

Hypothesis

Likely a race condition in the agent runtime initialization when multiple subagents are spawned simultaneously. The classifyHandoffIfNeeded function may not be available yet when the agent bootstrap tries to call it.

View original on GitHub ↗

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