dsh plugin add promotes pre-existing bundle-declaring deps into the bundle stack and breaks the next boot with "duplicate loader entry id" #1404
Replies: 2 comments
|
Confirmed — this is a real and distinct bug from #1377 (which I also verified). Here's the exact chain in master, plus why the duplicate-id crash happens. Source confirmation1.
for (const packageName of dependencies) {
const isBundle = exportsPatch(packageName, profileDir)
if (isBundle && !plugins.includes(packageName)) {
plugins.push(packageName)
changed = true
}
...
}This runs on every 2. The duplicate id comes from the user patch The boot sequence composes:
if (seen.has(id)) throw new TypeError(`duplicate loader entry id: ${id}`)3. Why This vs #1377
Both stem from the same root: Fix suggestions
The cleanest long-term fix is making the reconcile diff-aware (compare dependency changes since last invocation, like the second loop already does for removal via Want me to draft the diff-aware reconcile patch against |
|
Thanks for the thorough verification — the source-level walkthrough (the promotion loop in I agree with your direction:
And yes — if you draft the patch, I would be glad to test it. I still have the exact repro (profile with a bundle-declaring Since issues are disabled upstream, a PR is the right vehicle — happy to help however that lands. |
Uh oh!
There was an error while loading. Please reload this page.
dsh plugin addpromotes pre-existing bundle-declaring deps into the bundle stack and breaks the next boot with "duplicate loader entry id"TL;DR (中文摘要)
dsh plugin --profile web add <pkg>安装成功后,会把所有声明了dsh.bundle的依赖(包括本次命令之前就存在、一直靠cordis.patch.ymlinsert 加载的插件)追加进dsh.profile.bundles。如果用户 patch 里仍保留这些插件的 insert,下一次启动dsh web时 cordis loader 会因重复 entry id 直接崩溃:dsh --profile web --dump-config检测不到这个问题(它不挂载 loader),只有真实启动才报错。Environment
@deepseek-ai/dsh0.1.0-rc.6 (launched vianpx @deepseek-ai/dsh web)webSteps to reproduce
file:dependencies and loaded only through the user patch layer (profiles/<name>/cordis.patch.ymlinserts) — e.g.dsh-better-sidebarand@liustack/modlens, whose packages do declare"dsh": { "bundle": { "patch": "./cordis.patch.yml" } }but are not indsh.profile.bundles.dsh plugin --profile web add dshmarket(any package triggers it).dsh web→ crash:duplicate loader entry id: better-sidebar(andmodlens).Root cause
dsh plugin(thereconcilePluginsstep inlib/plugin-*.js) reconcilesdsh.profile.bundlesagainst the installed state on every invocation: every dependency that resolves to a package declaringdsh.bundle.patchis appended to the bundle layer list. This is intentional (anupdateshould activate a package that gained the declaration in a newer version), but it also promotes pre-existing dependencies that were never bundle layers and were being loaded via user-patch inserts.The user's own patch layer (
cordis.patch.yml) is not reconciled: its now-redundantinsertentries remain, so the same entry id is inserted twice.cordis-plugin-loader'sEntryGroup.updatethrows on duplicate ids at mount time.--dump-confignever mounts the loader, so the duplicate is invisible there (verified: dump-config exits 0 with both duplicate rows present in the composed tree) — the failure only appears on a real boot.Workaround (what fixed it)
Back up and edit
profiles/web/cordis.patch.yml: remove theinsertentries whose ids are now provided by bundle layers (in my casebetter-sidebarandmodlens); keep only the non-bundle inserts (@local/dsh-emoji-picker,@local/dsh-ui-customizer). Boot then succeeds.Suggested fixes (any would help)
.bakbackup) or fail with an actionable message naming the exact file and entries to remove.dsh --profile web --check, or make--dump-configdo a mount-only dry run) so duplicate ids surface before the user restarts.pnpmis missing,dsh pluginprints "pnpm not found on PATH — install pnpm to manage profile plugins" but could suggest concrete commands (corepack enable pnpm/npm i -g pnpm); the dshmarket plugin already provisions pnpm this way.Note
dshmarket's one-click install also shells out to
dsh plugin --profile <name> add, so it inherits this behavior — a user installing anything from the market can hit the same crash if their user patch contains inserts for bundle-declaring packages.All reactions