Turn fails with "Cannot read properties of undefined (reading prepare)" on tool dispatch (0.1.1-rc.2) #4667
Replies: 2 comments
|
This is a duplicate copy of The short version: the agent loop looks the scheduler up on the ToolRuntime by a symbol key, and that key is currently a module-local Two things worth knowing while a fix lands: Finding it. Look for more than one Your session is probably not recoverable. The failing turn appends The fix is to key on the global symbol registry ( |
|
@nokkies has your primary crash. I want to pick up the secondary issue nobody has answered, because on your own evidence it is not secondary — it is what produced the crash. Your two problems are one causal chain. The model could not see the image, so it went looking for it with It is also the same failure shape as the crash you reported, one layer up: in both cases the system already held the information the user needed and did not put it in front of them. The symbol lookup returns One concrete thing to check, because what you saw does not match what this version line is supposed to do. On the 0.1.1 line the host's own dispatch resolves the modality mismatch and replaces the image block with an explicit If what you actually want is for a text-only model to answer questions about pasted images, there is a working path today that does not involve DSH changing anything: a vision-companion plugin sends the image to a vision model you configure and injects the analysis into the turn, so the text model answers about the picture. I maintain the compatibility engine that path runs on, so treat this as an interested party's answer — it is verified end to end on a real DSH loop, CLI and web, but it is a parallel path, not a repair: DSH's own attachment handling and the missing notice are untouched, and your request that the host either block the attachment or say something is still the right ask on this thread. |
Uh oh!
There was an error while loading. Please reload this page.
Environment
@deepseek-ai/dsh@0.1.1-rc.2(npm global, latest rc)dsh webSymptom
A turn dies immediately when the model emits a tool call. The web UI shows "本轮运行失败 / Cannot read properties of undefined (reading 'prepare')" with code
UNKNOWN. The tool never executes.The session log (
session.jsonl.zstd) shows the failure happens within ~3ms of registering the call, with notool/resultever recorded:{"type":"tool/call","data":{"turn":11,"step":1,"name":"bash",...}} {"type":"step/end","data":{"turn":11,"step":1}} {"type":"turn/end","data":{"turn":11,"reason":{"kind":"error","error":{"message":"Cannot read properties of undefined (reading 'prepare')","code":"UNKNOWN"}}}}Suspected cause
In
@deepseek-ai/dsh-agent-loop/lib/index.js(runGroup→startCall):TOOL_RUNTIME_SCHEDULERis a module-localSymbol("@deepseek-ai/dsh-tools.scheduler")defined in@deepseek-ai/dsh-tools, and the scheduler is attached to theToolRuntimeservice instance under that symbol key. The error text (reading 'prepare', notreading 'Symbol(...)') meansctx.toolsexists but the symbol slot isundefined— i.e. the symbol identity seen bydsh-agent-loopno longer matches the one used to build the liveToolRuntime. This smells like a duplicate/reloaded module instance (e.g. after a cordis HMR plugin reload in the long-runningdsh webprocess), which would invalidate everySymbol()-keyed cross-package lookup.Reproducibility
Observed in 7 different sessions between 2026-08-20 and 2026-08-26. In each session the crash happens at the first tool call the model makes (turn 1 for fresh sessions, mid-session otherwise); before the crash those sessions only contain plain-text turns. Restarting the
dsh webprocess makes tool calls work again, suggesting the bad state is process-level, not session-level.Related secondary issue
When the user attaches an image in the web UI, the model (DeepSeek, text-only) receives only a textual reference (
Image sha256:...; 884x650px) with no image content. The model's own reasoning in the log shows it cannot see the image ("we cannot see actual image... I don't have vision"), and it resorts to runningfind / -type f -iname '*.png' ...across the whole filesystem to locate the file — which is how we hit the crash above. Consider either blocking image attachments for non-vision models or surfacing a clear capability notice.Happy to provide the raw session jsonl if useful.
All reactions