classifyHandoffIfNeeded is not defined - Framework error in custom subagent completion

Resolved 💬 3 comments Opened Feb 1, 2026 by Hellblazer Closed Feb 4, 2026

Claude Code Version: 2.1.27 - 2.1.29
Platform: macOS Darwin 25.2.0

Summary

Custom subagents spawned via the Task tool fail with classifyHandoffIfNeeded is not defined during task completion. The error occurs after all agent work completes successfully, making it cosmetic but confusing.

Severity

Medium - No data loss, but causes user confusion.

Steps to Reproduce

  1. Create a custom subagent in ~/.claude/agents/example.md
  2. Spawn it via Task tool: Task(subagent_type="example", prompt="...")
  3. Let the agent complete its work
  4. Observe error when agent attempts to return

Reproduction rate: 100% on affected agents

Expected vs Actual

Expected: Agent completes and returns results without error.

Actual:

  1. Agent completes all work successfully
  2. Agent persists all outputs
  3. Error occurs: classifyHandoffIfNeeded is not defined
  4. User sees error despite work being complete

Key Observations

  • Error occurs in framework code, not user agent definitions
  • Happens across all models (haiku, sonnet, opus)
  • No data loss - all work completes before error
  • Only affects some custom agents, not all (unclear pattern)
  • Function classifyHandoffIfNeeded appears to be referenced but not defined in the agent completion/handoff code path

Workaround

We documented this as a known cosmetic error and instruct users to verify agent output files - the work is always complete despite the error notification.

View original on GitHub ↗

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