--profile headless crashes on any tool call: "Cannot read properties of undefined (reading 'prepare')" (0.1.1-rc.2) #4529
Replies: 3 comments 1 reply
|
Checked both of your candidate call sites in the source. ctx.tools[TOOL_RUNTIME_SCHEDULER] is a plain class property set to a real object right on the tools registry itself (packages/core/tools/src/index.ts:796). It is not optionally registered and does not depend on any plugin being mounted. So if ctx.tools exists at all, that scheduler object should not be undefined. This makes your first guess unlikely to be the real cause. Your second guess does not hold up either. dsh-base's cordis.patch.yml mounts session-persistence-jsonl unconditionally for every profile, including headless. So session persistence should be present by default too. Neither lead points to an obvious missing plugin. Your own idea, printing the real stack trace behind the UNKNOWN error, is probably the fastest way to actually find this, since right now it is not clear which prepare() call is the undefined one. |
|
yes headless runs tool calls out of the box your persistence hunch is out what dies is this const prepared = await ctx.tools[TOOL_RUNTIME_SCHEDULER].prepare(call.exec)
reproduced on a clean
so check here assuming the default home any guess and not verified -> how it landed there on diagnostics you are right |
|
Confirmed on both counts — thank you, that was fast and exactly right. The duplicate existed. Fix verified: renaming that one directory away, same command, same patch — the tool-using task now completes, exit 0, model returns the file contents. So my earlier control run was flawed: I had unmounted the plugin but left the packages on disk, which is why the crash "survived without the plugin". The For anyone else who lands here: if you install any plugin into a profile home with plain One follow-up question, since the tool path now works: with |
Uh oh!
There was an error while loading. Please reload this page.
Issues are disabled on the repo, so posting here as the README suggests.
Symptom
With
--profile headless, every turn where the model calls a tool dies with:The same setup, same command, same session — but a task phrased so the model answers without any tool ("reply with exactly PONG, do not use tools") — completes normally and exits 0. So the model/provider path is healthy; the failure is on the tool path.
Environment
@deepseek-ai/dsh@0.1.1-rc.2(currentlatestat time of writing)npx -y @deepseek-ai/dsh@0.1.1-rc.2 --profile headless --patch <overlay> "<task>"DEEPSEEK_BASE_URLWhat I ruled out
Not caused by a third-party plugin. I first hit this with a hooks bridge plugin mounted, so I re-ran the identical tool-using task with a patch overlay that mounts no third-party plugin at all — same crash, byte-identical message. That control run is why I'm reporting it here rather than debugging my own plugin.
Not
dsh-session-query-sqlitebeing mounted withopenAt: never. That was my first hypothesis, since the docs say a search under that setting should fail with a typedSESSION_QUERY_SEARCH_DISABLEDrather than crash. I overrode it toopenAt: first-searchwith a real database path — no change, same crash. Recording this so nobody re-tests the same dead end.Where I think it comes from
Grepping the installed bundle for
.prepare(call sites, the candidates are:scheduler.prepare(indsh-tools— best fit, since the failure is specific to the tool pathpersistence.prepare()/ctx.sessions.prepare()indsh-agent-loopReading
undefined.preparesuggests an optional dependency that the tool path assumes is present.dsh-session-persistenceis declared optional (peerDependenciesMeta), so one plausible shape is: theheadlessprofile does not mount it, and something on the tool path dereferences it unguarded instead of degrading.Question for maintainers: is
--profile headlessexpected to run tool calls out of the box, or does it require mounting an additional plugin (session persistence or similar)? If the latter, a typed error naming the missing capability would save a lot of guessing — right now it surfaces as anUNKNOWNTypeError.Secondary: headless has no way to self-diagnose this
dsh-headlessprintserror.messageonly. No stack trace, and--helpexposes no log/debug/verbose flag I could find. With anUNKNOWNTypeError and no frame, there is nothing for a user to act on — I had to grep the shipped bundle to form even a guess.Two small things that would have turned this into a five-minute fix on my side:
--verbose/ aDSH_LOG_LEVELenv var) when the error is not a typed harness error.Happy to run any additional repro or provide the patch overlay if useful.
All reactions