[BUG] Subagent SendMessage-resume 400s: deferred tool (ReportFindings) referenced in transcript not rehydrated into tools[] on resume

Open 💬 0 comments Opened Jul 13, 2026 by davdittrich

Summary

Resuming a completed background subagent via SendMessage fails immediately with:

Agent terminated early due to an API error:
API Error: 400 Tool reference 'ReportFindings' not found in available tools

The resumed agent never runs any work — it 400s at request validation. A fresh Agent spawn of the same subagent type on the same task works fine; only the resume-from-transcript path fails. ReportFindings is a deferred, skill-injected tool the subagent never called — it merely appears by name in the reconstructed transcript.

Environment

  • Claude Code v2.1.x (interactive CLI), model Opus 4.8 (claude-opus-4-8[1m])
  • Linux
  • Session had code-review capability active, so the top-level tool catalog contained ReportFindings ("Report code-review findings as a typed list…"), plus MCP servers (lean-ctx, tokensave) contributing many deferred tools surfaced on demand via ToolSearch.

Reproduction

  1. In a session where ReportFindings is present as a (deferred) tool, spawn a general-purpose subagent with the Agent tool (run_in_background: false) and give it a run-and-report task. It completes normally and returns an agentId.
  2. Continue that agent with SendMessage({ to: <agentId>, message: "<follow-up>" }). The tool result confirms: "had no active task; resumed from transcript in the background."
  3. Before doing any work, the continuation dies. Task-notification arrives with status=failed and summary:

Agent "…" failed: Agent terminated early due to an API error: API Error: 400 Tool reference 'ReportFindings' not found in available tools

Observed reliably: first spawn = success (10–14 tool calls, full report); every SendMessage-resume of that same agent = instant 400 on ReportFindings.

Expected

Resume-from-transcript reassembles the continuation request's tools[] to include every tool referenced anywhere in the resumed transcript (or neutralizes stale references), so Messages-API validation passes and the agent continues.

Actual

The Anthropic Messages API rejects the continuation request at validation because a tool referenced in the reconstructed messages (ReportFindings) is absent from that request's tools[]. ReportFindings is a deferred tool that was ambiently present in the parent session's catalog (code-review skill) and surfaced into the subagent's first-run tool set; the resume path does not rehydrate deferred-tool state, so it is omitted from tools[] on the continuation — producing the 400.

Root cause (hypothesis, ~65% confidence — inferred, no harness source)

The subagent resume-from-transcript path rebuilds tools[] from scratch and does not restore deferred tools that were loaded/surfaced during the original run (via ToolSearch or ambient skill injection). Any transcript that references such a tool by name → 400 "Tool reference X not found in available tools" on resume. A fresh spawn is unaffected because its new transcript never references the tool.

Suggested fixes (any one closes it)

  1. On resume, scan the reconstructed transcript for all referenced tool names and guarantee each is present in tools[] (rehydrate deferred tools by name before sending).
  2. Persist the deferred-tool registry alongside the agent transcript; restore it on resume.
  3. Before sending the continuation request, strip/neutralize tool_use blocks and system-reminders that name tools not in the current tools[].
  4. Stop leaking code-review-only tools (ReportFindings) into general-purpose subagents' catalogs — it has no business there and is the specific trigger.

Impact

  • Subagent continuation via SendMessage is unusable in any session with code-review (or other deferred / skill-injected) tools active — a hard failure, not graceful degradation.
  • Semi-silent: surfaces only as a task-notification failed with an API-error summary. Worse, any detached child process the subagent launched keeps running orphaned after the agent dies.

Related

  • #38183 — SendMessage / agent continuation + tool availability on resume
  • #69158 — subagent tool roster injected lazily (availability vs visibility)

Workaround

Spawn a fresh Agent each time instead of SendMessage-resuming a completed subagent. Fresh spawns reliably succeed.

View original on GitHub ↗