Subagent SessionEnd crash: classifyHandoffIfNeeded is not defined

Resolved 💬 2 comments Opened Feb 10, 2026 by jonschull Closed Mar 11, 2026

Bug

When a Task subagent completes, the session end process crashes with:

classifyHandoffIfNeeded is not defined

Reproduction

  1. Spawn a subagent via the Task tool (subagent_type: "general-purpose")
  2. Let it complete its work normally
  3. Agent reports status: failed with the above error

Observed behavior

  • The subagent completes all its work (file edits land in the working tree)
  • The crash happens during session teardown, not during execution
  • The function classifyHandoffIfNeeded does not exist in any user-controllable hook code — it appears to be internal to Claude Code
  • Custom SessionEnd hooks (.claude/settings.jsonsession_end.py) are not the cause — the crash occurs before/outside user hooks

Expected behavior

Subagent should report status: completed when its work finishes successfully.

Impact

  • Misleading: agents report "failed" when they actually succeeded
  • The parent session has to check the working tree to determine if work was actually done
  • Reproducible — happened on 3 consecutive subagent runs

Environment

  • Claude Code CLI (latest as of 2026-02-09)
  • macOS Darwin 25.2.0
  • Model: claude-sonnet-4-5-20250929 (subagent), claude-opus-4-6 (parent)

View original on GitHub ↗

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