dsh web fails to boot: unresolvable plugin reference in profile patch (cordis.patch.yml) #1197
Replies: 8 comments
|
A more precise root cause from the author's actual setup (verified against loader source) To clarify: the package was not missing in the strict sense — it existed in the dsh global installation at
Fix that works (matches the cd ~/.dsh/profiles/web
pnpm add "file:/path/to/your-package" # or install it into the profile's node_modules normallySuggestions for the loader, in addition to the great
Happy to provide the full repro profile + package if useful. |
|
Upvoting to bring to the team's attention per CONTRIBUTING. Ping @tianyicui @LegGasai — happy to provide the full profile tree or more logs if helpful for reproducing this class of failure. |
Update: root cause fully traced — it's a broken
|
| Check | Why it passes but means nothing |
|---|---|
npm view @dsh-user/dev-workbench → 404 |
It's a bundled plugin, not an npm package |
createRequire(<loader base>) resolves it |
The base sits inside the dsh install, so the parent-walk reaches the nested node_modules — different anchor than the profile |
dsh --dump-config passes |
It only composes the patch list, never imports entries (Entry._init never runs) |
Fix applied (verified)
cd ~/.dsh/profiles/web
pnpm add file:<dsh-install>/node_modules/@dsh-user/dev-workbench
# restore the insert in cordis.patch.ymlPutting the package back into the profile's node_modules puts it on the resolution anchor's parent chain — same mechanism dsh plugin add uses. dsh web boots normally again, plugin restored.
What this case says about the loader
The bug isn't really "a bad reference" — it's that the loader has no way to tell you why resolution failed and no way to degrade. A dangling file: link, a renamed package, a broken hoist — all produce the same opaque ERR_MODULE_NOT_FOUND that bricks the whole tree. Diagnostics like dsh doctor (scan profiles for dangling references / stale file: deps against lockfile) would turn this class of incident from a boot-crash + manual YAML archaeology into a one-command report.
|
patch 层引用不存在的包就整包 boot 失败——loader 不做引用校验这个设计确实是隐患,一个悬空引用拖垮整个 profile。 排查思路:看 boot 日志定位是哪个 insert 引用的包解析失败,先在 cordis.patch.yml 里注释掉那一行确认能起来,再决定是补依赖还是删引用。这类依赖/挂载坑第 3 章整理了不少:https://github.com/Electricitysheep/dsh-handbook/blob/main/docs/03-profiles.md |
|
Great root-cause tracing — the broken This is the complementary half of what I hit in #1404: same loader, two failure modes from the same design gap.
Both share the same three properties:
On the |
Update: fix implemented and tested — ready to submit when external PRs openPer CONTRIBUTING ("cannot accept external pull requests at the moment"), I've prepared the fix on a fork and will submit it as soon as external PRs are accepted. Sharing the implementation here so the team can review or adopt it directly: What it doesOn boot failure ( Changes
All green locally: Resulting error (instead of bare ERR_MODULE_NOT_FOUND)Fork branch: |
Same root cause, multiple failure modes — a map of related reportsThanks @moonquake2004 for linking #1404 — and @Electricitysheep for consolidating into #1496. Searching the forum, this design gap (plugin state coordination without validation/diagnostics) shows up repeatedly, in both directions:
What this saysAll of these are the loader/plugin-manager reconciling state blindly: Community toolingFor users hitting this now: a standalone |
|
dsh-doctor is now public — https://github.com/boyin111-1/dsh-doctor The standalone pre-boot checker mentioned above is released as a GitHub repo (no npm publish needed; dsh users already have Node): npx --yes github:boyin111-1/dsh-doctorChecks: dangling plugin refs (from the profile dir anchor), broken |
Uh oh!
There was an error while loading. Please reload this page.
TL;DR
dsh webfails to boot when the profile patch layer references a package that does not exist on npm. The loader applies the reference without validation, and a single dangling entry kills the entire plugin tree — no skip-and-warn, no graceful degradation. This may be related to reports of "plugins missing after restart".Environment
0.1.0-rc.6(installed via npm)webprofileReproduction
Run
dsh web. Observed output:Root cause
~/.dsh/profiles/web/cordis.patch.ymlcontains:@dsh-user/dev-workbenchdoes not exist on npm (npm view→ 404).package.jsondependencies, and not present innode_modules.Impact
Suggested fixes
name:at write time in the plugin manager / UI (reject 404s immediately), or at minimum validate at boot and surface the exact file/line/entry id.dsh doctor/dsh check) that scans profiles for dangling plugin references and undeclared dependencies — this case would have been caught in seconds.Workaround (applied)
Backed up
cordis.patch.yml, removed the danglinginsertblock.dsh webboots normally afterwards.All reactions