claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[CLI] TaskOutput rejects the task ids the session was given, including one TaskStop just returned

Open apollion69 opened this issue 1 month ago • 1 comments

Summary

TaskOutput rejects the task identifiers the session itself was handed. Calls fail with No task found with ID: <id>, including for an id that TaskStop had just returned, and for in-process teammate ids. There is no id form the tool accepts for those agents, so a result that exists cannot be read back through it.

This is distinct from the two open reports nearby: #90124 is about lookups going stale after /clear, and #92272 about reports arriving after a parent recovers from subagent files. Here the session never cleared and never recovered — the id was simply never resolvable.

Environment

  • Host: Windows 11 Enterprise 10.0.26200; repository on WSL2 Ubuntu
  • Claude Code CLI 2.1.299 now; the earliest captured occurrence is on 2.1.78
  • Models: claude-opus-5, claude-fable-5-1

Steps / measurement

Two separate captures.

1. Four raw errors, CLI 2.1.78. A session audit recorded four consecutive TaskOutput calls, each returning the error verbatim with the id it was given:

<tool_use_error>No task found with ID: bo0vl26m5</tool_use_error>
<tool_use_error>No task found with ID: b4q3wi4ue</tool_use_error>
<tool_use_error>No task found with ID: bddohlvel</tool_use_error>
<tool_use_error>No task found with ID: btxdpgspg</tool_use_error>

Those are well-formed background-task ids of the shape the Bash tool returns when a command is backgrounded.

2. Three failures on agent ids, later session. A second occurrence, recorded in our own notes at the time:

TaskOutput does not resolve name@session-… agent ids or in-process teammate ids (session bb7b7602: three calls, three failures, including the id TaskStop returned).

The last clause is the sharp part: TaskStop accepted an id, acted on it, and returned it; passing that same id to TaskOutput produced No task found with ID. Two tools in the same surface disagree about the same identifier space.

Not ours. We checked whether any of our own hooks or scripts emit that string — none does. It comes from the tool layer.

Expected

TaskOutput should accept the identifiers the session was given: background-task ids as returned when a command is backgrounded, agent ids as returned by Agent, and whatever TaskStop accepts. If a class of agent genuinely has no readable output through this tool — in-process teammates, say — the error should say that rather than claiming the task does not exist, because "no task found" sends the reader off to hunt for a wrong id instead of telling them the tool does not serve that case.

Workaround we use

We stopped using TaskOutput for this. Results are read by Reading the output_file path the tool call returned, which is reliable. Our own rules now say so explicitly, and also warn against calling TaskOutput in a loop waiting for a background agent, because the completion notification arrives in a later turn and the polling never succeeds:

to read a result now, Read the output_file path the Agent tool returned — TaskOutput is deprecated in favour of that.

If TaskOutput is in fact deprecated, saying so in the tool description would have saved the three failed calls and the time spent assuming the id was wrong.

apollion69 avatar Oct 16 '26 15:10 apollion69

Hey, I’m Frank on the Claude Code team. TaskOutput isn’t a tool anymore as of 2.1.277: Claude reads a background task’s output file instead, so there are no task ids for it to reject. Can you update and let me know if anything still goes wrong when it checks on a task?

franklee-ant avatar Nov 23 '26 23:11 franklee-ant