Description
During an --init run on a large monorepo, a research subagent called read_file on a binary file. The file content was serialized into the subagent's message history as a document-style content block whose media_type is not application/pdf. The Anthropic Messages API rejects any subsequent request containing that history:
400 invalid_request_error:
messages.N.content.0.tool_result.content.0.document.source.base64.media_type:
Input should be 'application/pdf'
Because the poisoned tool_result is already persisted in the LangGraph checkpoint, every retry — and every resumed run — replays the identical invalid request. The branch can never succeed.
This is related to but distinct from #284: that fix (deepagents ≥1.10.6 falling back to text/plain for unknown extensions) does not cover known non-text extensions.
Still present in latest (openwiki 0.1.2 / deepagents 1.10.8)
In deepagents 1.10.8 (dist/langsmith-DjCMSywL.js), read_file on a binary file still returns:
type: "file" with e.g. application/vnd.openxmlformats-officedocument.presentationml.presentation for .pptx/.ppt — Anthropic document blocks only accept application/pdf → 400
type: "audio" / type: "video" blocks — not supported by the Anthropic Messages API at all → 400
So any repo containing a .pptx, .ppt, or audio/video file that a subagent decides to read can still permanently wedge an init/update run when using the Anthropic provider.
Consequence: whole run dies, not just the branch
The failing subagent task doesn't fail gracefully. Observed sequence in the checkpoint __error__ channel:
400 invalid_request_error (repeats on retry)
AbortError: This operation was aborted (sibling tasks aborted)
TypeError: terminated — process exits
Re-running --init resumes the thread, makes progress on healthy branches for a few minutes, then hits the same 400 and dies again. Hours of research checkpoints become unusable without manual DB surgery.
Steps to Reproduce
openwiki --init (Anthropic provider) in a repo containing a .pptx (or other Office/audio/video) file located somewhere a research subagent will explore.
- A subagent reads the file; the next model call in that branch returns the 400 above.
- The run eventually dies with
TypeError: terminated.
- Re-running
openwiki --init resumes from the checkpoint and hits the same 400 — permanently wedged.
Workaround that confirmed the diagnosis
Deleting the poisoned subagent's rows from checkpoints/writes in ~/.openwiki/openwiki.sqlite (its checkpoint_ns = tools:<uuid>) and re-running let the run resume and re-execute that subagent cleanly.
Suggested fixes
- For the Anthropic provider, only emit base64 document blocks for
application/pdf and image blocks for supported image types; return a text placeholder (<binary file, N bytes, skipped>) for everything else (Office docs, audio, video).
- Validate/sanitize tool_result content before it enters checkpointed history — a malformed block is unrecoverable once persisted, since retries replay it.
- Isolate subagent failure: a task failing with a non-retryable 4xx should fail its branch with an error ToolMessage to the parent instead of aborting siblings and killing the run.
Environment
- openwiki 0.0.1 (bug reproduced), block-construction paths verified unchanged in 0.1.2 / deepagents 1.10.8
- provider:
anthropic, model: claude-sonnet-5
- macOS, node 25.9.0
Description
During an
--initrun on a large monorepo, a research subagent calledread_fileon a binary file. The file content was serialized into the subagent's message history as a document-style content block whosemedia_typeis notapplication/pdf. The Anthropic Messages API rejects any subsequent request containing that history:Because the poisoned tool_result is already persisted in the LangGraph checkpoint, every retry — and every resumed run — replays the identical invalid request. The branch can never succeed.
This is related to but distinct from #284: that fix (deepagents ≥1.10.6 falling back to
text/plainfor unknown extensions) does not cover known non-text extensions.Still present in latest (openwiki 0.1.2 / deepagents 1.10.8)
In deepagents 1.10.8 (
dist/langsmith-DjCMSywL.js),read_fileon a binary file still returns:type: "file"with e.g.application/vnd.openxmlformats-officedocument.presentationml.presentationfor.pptx/.ppt— Anthropic document blocks only acceptapplication/pdf→ 400type: "audio"/type: "video"blocks — not supported by the Anthropic Messages API at all → 400So any repo containing a
.pptx,.ppt, or audio/video file that a subagent decides to read can still permanently wedge an init/update run when using the Anthropic provider.Consequence: whole run dies, not just the branch
The failing subagent task doesn't fail gracefully. Observed sequence in the checkpoint
__error__channel:400 invalid_request_error(repeats on retry)AbortError: This operation was aborted(sibling tasks aborted)TypeError: terminated— process exitsRe-running
--initresumes the thread, makes progress on healthy branches for a few minutes, then hits the same 400 and dies again. Hours of research checkpoints become unusable without manual DB surgery.Steps to Reproduce
openwiki --init(Anthropic provider) in a repo containing a.pptx(or other Office/audio/video) file located somewhere a research subagent will explore.TypeError: terminated.openwiki --initresumes from the checkpoint and hits the same 400 — permanently wedged.Workaround that confirmed the diagnosis
Deleting the poisoned subagent's rows from
checkpoints/writesin~/.openwiki/openwiki.sqlite(itscheckpoint_ns = tools:<uuid>) and re-running let the run resume and re-execute that subagent cleanly.Suggested fixes
application/pdfand image blocks for supported image types; return a text placeholder (<binary file, N bytes, skipped>) for everything else (Office docs, audio, video).Environment
anthropic, model:claude-sonnet-5