Repository navigation
[Bug][Windows] Case mismatch in node_modules causes duplicate ESM instances and profile settings save failure #9542
mannerismw-byte
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
[Bug][Windows] Case mismatch in
node_modulescauses duplicate ESM instances and profile settings save failureSummary
On Windows 11, DeepSeek Harness
0.2.0-rc.2failed to persist Web UI settings on my machine when the actual npm global modules directory was namedNode_modules(uppercase N), while npm and the initial ESM import usednode_modules(lowercase n).The application started successfully, but accepting the developer preview notice produced:
Runtime instrumentation traced the failure to two separate evaluations of
@deepseek-ai/dsh-app-bootunder module URLs differing in directory-name capitalization. A temporary source workaround allowed the UI to proceed. Renaming the physical directory to lowercase subsequently eliminated the measured path mismatch. After restoring the original, unmodifieddsh-app-bootsource, I also confirmed that the Web UI could save the confirmation successfully without the temporary source patch.Environment
v24.21.011.19.00.2.0-rc.2npm install -g @deepseek-ai/dsh@0.2.0-rc.2D:\Application\Node_home\Node_globalfsutil)Steps to reproduce
The following describes the failing setup observed on my machine:
D:\Application\Node_home\Node_global.Node_modules(uppercase N).dsh web.Reproduction limitation: These steps document one observed environment; they have not been independently reproduced on a clean Windows installation.
Actual vs. expected behavior
Actual: Saving the confirmation returned
settings/rejectedwith the underlyingroot Include entryerror.Expected: The Web UI should persist settings even when differently capitalized path strings refer to the same directory on a case-insensitive Windows filesystem.
Investigation and evidence
1. Two separate module evaluations
Temporary instrumentation in
dsh-app-boot/lib/index.jsrecorded two module initialization events during one DSH Web session. Both had the same process ID,threadId: 0, and referred to the same file on disk, but they had differentimport.meta.urlvalues:2. Root Include state was not shared
Instrumentation of the module-level
bootstrapIncludesWeakMap showed:The same Context object had been registered in the first module instance, but the reload path accessed a different instance with a separate WeakMap.
3. Second import originated from Cordis Loader
The stack from the second module evaluation included:
The loader delegates imports through:
4. Path canonicalization mismatch
The installed
dsh-app-bootversion contains:With the physical directory named
Node_modules, the following local test returned:The native realpath output matched the capitalization of the second module URL. Together with the runtime instrumentation, this supports a path-identity mismatch as the cause of the separate ESM module instances in this execution.
Local verification and workarounds
Workaround A: Temporary local code change
I temporarily replaced:
with:
After the change, the Web UI advanced past the developer preview notice to the API key configuration screen. This was a diagnostic workaround, not a proposed final cross-platform fix.
Workaround B: Normalize the physical directory name
I then renamed the physical npm global modules directory from
Node_modulestonode_modulesand aligned theNODE_PATHsetting. Both path resolution functions subsequently returned:This eliminated the observed capitalization discrepancy without requiring the directory names of its parent folders to be changed. I then restored the original
dsh-app-bootsource from the pre-patch backup and verified that the Web UI confirmation could be saved successfully without the temporary code change.Final verification and limitations
realpathSync()andrealpathSync.native()outputs.dsh-app-bootsource, I confirmed that the Web UI could save the developer-preview confirmation successfully. This verifies the filesystem-only workaround on my machine, without a permanent source patch.Suggested investigation
Please consider using consistent module-URL canonicalization across initial ESM imports and dynamic plugin imports on Windows. A regression test could cover:
Node_moduleswhen callers usenode_modules.Simply replacing
realpathSync.native()withrealpathSync()globally may have unintended cross-platform effects; a tested resolution strategy would be preferable.Related discussions
root Include entryfailure and module-state investigation.This report documents an additional observed trigger involving the physical capitalization of the npm global
node_modulesdirectory.I can provide sanitized logs, an isolated reproduction, or test a proposed fix if helpful.
Thanks for maintaining DeepSeek Harness!
All reactions