[Bug] Background agents fail with "classifyHandoffIfNeeded is not defined" after completing work (v2.1.37)

Resolved 💬 3 comments Opened Feb 8, 2026 by filscotthenrique Closed Feb 11, 2026

## Description

Background agents (run_in_background: true) report status: failed with
error
classifyHandoffIfNeeded is not defined despite completing their work
successfully.

## Reproduction

  1. Launch 2+ background agents via the Task tool (subagent types:

researcher, Explore)

  1. Agents complete all tool calls and produce final assistant messages
  2. Both agents independently fail with the same error during handoff

## Environment

  • Claude Code version: 2.1.37
  • Platform: macOS Darwin 25.2.0
  • Model: claude-opus-4-6 (parent), claude-sonnet-4-5-20250929 /

claude-haiku-4-5-20251001 (agents)

## Details

  • Agent aa37eab (researcher, Sonnet): 2 assistant messages, full research

output produced → failed

  • Agent a0bf922 (Explore, Haiku): 129 tool calls, comprehensive codebase

exploration → failed

  • Error occurs AFTER agent completes work, during the subprocess

handoff/classification phase

  • Error string not present in parent session debug log — only surfaces in

task notification

  • Agent output transcripts contain complete, correct results
  • Zero data loss — parent successfully read agent output before failure

notification

## Expected Behavior

Agents that complete their work should report status: completed, not
status: failed.

## Impact

Low (workaround: parent reads output before failure notification).
But the false failure status is confusing and could cause automation to
incorrectly retry.

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 2.1.37
  • Feedback ID: 150ad51b-6d49-4804-b5ff-8e22ba39b622

Errors

[{"error":"Error: Error opening file /Users/filipehenrique/.claude/projects/-Users-filipehenrique-abeam/agent-a0c5f1f.jsonl: Error: ENOENT: no such file or directory, open '/Users/filipehenrique/.claude/projects/-Users-filipehenrique-abeam/agent-a0c5f1f.jsonl'\n    at JRT (/$bunfs/root/claude:62:318)\n    at async <anonymous> (/$bunfs/root/claude:4453:4044)\n    at async LLT (/$bunfs/root/claude:4453:3886)\n    at async <anonymous> (/$bunfs/root/claude:4453:11500)\n    at async YjA (/$bunfs/root/claude:4453:141)\n    at async cnB (/$bunfs/root/claude:4453:10998)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-02-08T01:32:53.548Z"},{"error":"Error: Error opening file /Users/filipehenrique/.claude/projects/-Users-filipehenrique-abeam/agent-ac47672.jsonl: Error: ENOENT: no such file or directory, open '/Users/filipehenrique/.claude/projects/-Users-filipehenrique-abeam/agent-ac47672.jsonl'\n    at JRT (/$bunfs/root/claude:62:318)\n    at async <anonymous> (/$bunfs/root/claude:4453:4044)\n    at async LLT (/$bunfs/root/claude:4453:3886)\n    at async <anonymous> (/$bunfs/root/claude:4453:11500)\n    at async YjA (/$bunfs/root/claude:4453:141)\n    at async cnB (/$bunfs/root/claude:4453:10998)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-02-08T01:32:53.615Z"},{"error":"Error: Error opening file /Users/filipehenrique/.claude/projects/-Users-filipehenrique-abeam/agent-a9fc820.jsonl: Error: ENOENT: no such file or directory, open '/Users/filipehenrique/.claude/projects/-Users-filipehenrique-abeam/agent-a9fc820.jsonl'\n    at JRT (/$bunfs/root/claude:62:318)\n    at async <anonymous> (/$bunfs/root/claude:4453:4044)\n    at async LLT (/$bunfs/root/claude:4453:3886)\n    at async <anonymous> (/$bunfs/root/claude:4453:11500)\n    at async YjA (/$bunfs/root/claude:4453:141)\n    at async cnB (/$bunfs/root/claude:4453:10998)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-02-08T01:32:53.632Z"},{"error":"Error: EISDIR: illegal operation on a directory, read\n    at readFileSync (unknown)\n    at <anonymous> (/$bunfs/root/claude:12:742)\n    at oC (/$bunfs/root/claude:11:49132)\n    at readFileSync (/$bunfs/root/claude:12:701)\n    at nzB (/$bunfs/root/claude:6110:17996)\n    at call (/$bunfs/root/claude:3269:2360)\n    at yO8 (/$bunfs/root/claude:3447:13995)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-02-08T01:33:07.113Z"},{"error":"Error: EISDIR: illegal operation on a directory, read\n    at readFileSync (unknown)\n    at <anonymous> (/$bunfs/root/claude:12:742)\n    at oC (/$bunfs/root/claude:11:49132)\n    at readFileSync (/$bunfs/root/claude:12:701)\n    at nzB (/$bunfs/root/claude:6110:17996)\n    at call (/$bunfs/root/claude:3269:2360)\n    at yO8 (/$bunfs/root/claude:3447:13995)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-02-08T01:49:25.975Z"}]

View original on GitHub ↗

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