Agents crash with 'classifyHandoffIfNeeded is not defined' after completing work

Resolved 💬 3 comments Opened Feb 2, 2026 by vanman2024 Closed Feb 5, 2026

Bug Description

All Task tool agents (subagents) are crashing with the error classifyHandoffIfNeeded is not defined after successfully completing their work. The agents write their files correctly but fail during the final cleanup/handoff phase.

Error Message

Agent "Create Component spec generator" failed: classifyHandoffIfNeeded is not defined

Reproduction

  1. Use the Task tool to launch any agent type (tested with multiple):
  • nextjs-frontend:component-builder-agent
  • nextjs-frontend:api-route-generator-agent
  • nextjs-frontend:supabase-integration-agent
  • vercel-ai-sdk:vercel-ai-tools-agent
  1. Agent completes its work (files are created successfully)
  2. Agent crashes with classifyHandoffIfNeeded is not defined

Observed Behavior

  • Files ARE created before the crash
  • Error occurs at the END of agent execution (during handoff/cleanup)
  • Affects ALL agent types tested
  • 6/6 agents crashed with identical error in one session
  • TypeScript compilation confirms all generated code is valid

Expected Behavior

Agents should complete without crashing after writing files.

Environment

  • Platform: Windows 11
  • Claude Code: Latest version
  • Model: claude-opus-4-5-20251101

Impact

  • High annoyance factor (failure notifications for successful work)
  • May cause issues if downstream logic depends on agent success status
  • Started happening recently - agents were working fine before

Workaround

None needed for file generation (files are written before crash), but the false failure status is problematic for automation.

View original on GitHub ↗

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