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
- Create a custom subagent in
~/.claude/agents/example.md - Spawn it via Task tool:
Task(subagent_type="example", prompt="...") - Let the agent complete its work
- 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:
- Agent completes all work successfully
- Agent persists all outputs
- Error occurs:
classifyHandoffIfNeeded is not defined - 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
classifyHandoffIfNeededappears 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.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗