Repository navigation
Description
Client or integration
OpenCodex dashboard
Area
Installation or packaging
Summary
On Windows, the official update path (ocx update / dashboard background worker) fails to move 2.59.0 → 2.63.0 with:
更新失败。 2.59.0 -> 2.63.0. update command failed (1)
The sanitized job diagnostic is:
exit 1 · code: ENOTDIR · syscall: mkdir · 1953 bytes of full output withheld
Integrity pre-flight succeeds. The proxy is stopped first (as designed). The subsequent npm install -g @bitkyc08/[email protected] then fails with Node/libuv ENOTDIR on mkdir. A leftover npm rename-aside directory remains (node_modules/@bitkyc08/.opencodex-<rand>/), and cleanup of that tree fails with EPERM on bunx.exe.
Expected: the official updater either completes the global replace, or fails closed with a recovery path that restores a working install and reports a concrete next step.
Actual: update reports only update command failed (1); the working 2.59.0 install is left in place (good), but a stale temp tree remains and the only successful path afterwards is a manual npm install -g after stopping the proxy again.
Related but distinct:
- [Bug][Windows] Auto-update leaves proxy dead after npm EPERM on bun binary replacement #281 —
EPERMonbunx.execleanup after install; our failure isENOTDIR/mkdirduring install (exit 1), so the replace itself never completes. - [Bug][Windows] Failed ocx update leaves a file-less package skeleton; service wrapper restart-loops 1,009 times with no integrity check or backoff #1849 — failed update left a file-less package skeleton + launchers gone; here the old package remained runnable and launchers stayed intact.
- [Bug][Windows] ocx update is not transactional: a failed update deletes the working install with no rollback #1942 / [Bug][Windows] Bare npm reinstall can leave a live proxy on a mixed old/new module graph #2459 / [Bug][Windows] package_tree_changed guard fences /healthz, so ocx restart cannot discover the proxy it tells you to restart (#2459 follow-up) #5496 — transactional replace / mixed module graph / recovery fencing. This report is the install-step failure that feeds those recovery paths.
No existing issue mentions ENOTDIR or syscall: mkdir.
Reproduction
Environment at failure:
| Item | Value |
|---|---|
| OS | Windows 11 Home China, build 10.0.26100, AMD64 |
| Node | v24.13.1 |
| npm | 11.8.0 |
| Installer | npm global (%APPDATA%\npm) |
| npm cache | D:\Cache\npm (second volume) |
| registry | https://registry.npmmirror.com |
| Service backend | Task Scheduler (opencodex-proxy) |
| opencodex before | 2.59.0 |
| target | 2.63.0 |
| Codex | 0.155.0-alpha.9.2 (configured runtime) |
Steps (as observed):
- Service-managed proxy running on 10100 from a global npm install of
2.59.0(bundled Bun). Windows tray + Codex autostart shim installed. Codex app-server live. - Trigger dashboard /
ocx update(channellatest). - Worker verifies registry integrity for
@bitkyc08/[email protected](sha512 matches) — OK. - Worker stops the proxy / unloads the service — OK.
- Worker runs
npm install -g @bitkyc08/[email protected]. - npm fails:
code: ENOTDIR,syscall: mkdir, exit 1. - Recovery restarts the old service; job status becomes
failedwitherror: "update command failed (1)". - On disk afterwards:
node_modules/@bitkyc08/opencodex/still 2.59.0 (runnable)node_modules/@bitkyc08/.opencodex-<rand>/leftover- leftover cleanup cannot unlink
.../node_modules/bun/bin/bunx.exe(EPERM, errno -4048) while any process still holds that image
Not intermittently re-run through the GUI after the first failure (leftover + live tray/service make repeated auto-updates noisy). A subsequent manual npm install -g @bitkyc08/[email protected] in a normal shell succeeded in ~6s and reported the same EPERM cleanup warning on the leftover temp tree, then:
added 1 package, and changed 100 packages in 6s
So the tarball/registry/cache path is fine; the failure is specific to the updater-spawned npm install -g replace dance under Windows file locks.
Version
Running process at failure: 2.59.0.
Target / post-manual-install package: @bitkyc08/[email protected].
Diagnostic extraction matches src/update/job.ts (NPM_ERROR_CODES includes ENOTDIR, POSIX_SYSCALLS includes mkdir).
Operating system
Windows 11 Home China, build 10.0.26100. Bundled Bun runtime, service backend scheduler (Task Scheduler).
Provider and model
Not provider-specific. Fails during package replacement, before any provider translation.
Logs or error output
From ~/.opencodex/update-job.json (paths already withheld by the job sanitizer):
{
"status": "failed",
"currentVersion": "2.59.0",
"latestVersion": "2.63.0",
"channel": "latest",
"installer": "npm",
"restart": true,
"log": [
"Update job queued for 2.59.0 -> 2.63.0.",
"Update worker started as PID 15132.",
"Verified @bitkyc08/[email protected] integrity metadata sha512-TQCsGHZI0wrmUDQYB…",
"<withheld: 109 bytes, may contain local paths>",
"exit 1 · code: ENOTDIR · syscall: mkdir · 1953 bytes of full output withheld",
"<withheld: 187 bytes, may contain local paths>",
"exit 0 · 35 bytes of output withheld (no recognized diagnostic fields)"
],
"exitCode": 1,
"error": "update command failed (1)"
}User-visible symptom:
更新失败。 2.59.0 -> 2.63.0. update command failed (1)
After a later manual install, npm verbose log showed the same lock class on the leftover tree:
npm warn cleanup Failed to remove some directories [
npm warn cleanup '...\\@bitkyc08\\.opencodex-<rand>\\node_modules\\bun\\bin\\bunx.exe'
npm warn cleanup [Error: EPERM: operation not permitted, unlink '...\\bunx.exe'] {
npm warn cleanup errno: -4048,
npm warn cleanup code: 'EPERM',
npm warn cleanup syscall: 'unlink'
npm warn cleanup }
]
Workaround that restored 2.63.0 (verified healthy afterwards):
# after understanding the failure; service still installed
npm install -g @bitkyc08/[email protected]
ocx stop
# remove leftover node_modules/@bitkyc08/.opencodex-* if EPERM allows after stop
ocx service start
ocx health --json then returned {"ok":true,...} on port 10100.
Screenshots and supporting files
No screenshots. Full npm verbose log of the successful manual install was captured locally and then deleted (contained absolute paths). Happy to re-capture a failed updater run with a private log if useful.
Redacted configuration
{
"service-state.json": {
"version": 2,
"backend": "scheduler",
"opencodexHome": "<HOME>\\.opencodex",
"cliPath": "<NPM_PREFIX>\\node_modules\\@bitkyc08\\opencodex\\src\\cli\\index.ts",
"bunPath": "<NPM_PREFIX>\\node_modules\\@bitkyc08\\opencodex\\node_modules\\bun\\bin\\bun.exe"
},
"runtime-port.json": {
"pid": 32292,
"port": 10100,
"attestationSecret": "<redacted>"
},
"npm": {
"prefix": "<NPM_PREFIX>",
"cache": "<OTHER_DRIVE>\\Cache\\npm",
"registry": "https://registry.npmmirror.com"
}
}Why this is still worth a separate issue
- Failure mode is
ENOTDIR/mkdiron the install step, notEPERMon post-install cleanup ([Bug][Windows] Auto-update leaves proxy dead after npm EPERM on bun binary replacement #281) and not an emptied skeleton ([Bug][Windows] Failed ocx update leaves a file-less package skeleton; service wrapper restart-loops 1,009 times with no integrity check or backoff #1849). The sanitized job line is the only breadcrumb the UI gives (update command failed (1)), so operators cannot tell which of the three they hit. - Official updater + integrity pre-flight + stop-first still cannot replace the package when
bun.exe/bunx.exeimage locks remain (tray, scheduler wrapper children, Codex shimensuresidecar, AV scanners). Manualnpm install -gimmediately afterwards works — so this is updater sequencing, not registry corruption. - Leftover
.opencodex-*trees accumulate (same as [Bug][Windows] Auto-update leaves proxy dead after npm EPERM on bun binary replacement #281) and make subsequent updates noisier.
Suggested fix
Any of these would help; 1–2 are the high-value ones.
- Release Bun image locks before
npm install -g. Afterocx stop, also stop the Windows tray and any service wrapper /ensurechildren that may still mapbun.exe/bunx.exe, then wait/retry until those images are deletable (or use a short backoff retry onENOTDIR/EPERM/EBUSYfrom the install step). [Bug][Windows] Auto-update leaves proxy dead after npm EPERM on bun binary replacement #281 asked for this on the cleanup side; the same lock also breaks the replace. - Treat
ENOTDIR/EPERM/EBUSYon the install step as a lock class, not a generic failure. Surface a distinct error (e.g.update blocked by locked package files) and print the manual recovery (ocx stop→npm install -g …→ocx service start) in the UI/job log instead of onlyupdate command failed (1). - Post-failure sweep of
node_modules/@bitkyc08/.opencodex-*once the install step exits non-zero and processes are known stopped (same ask as [Bug][Windows] Auto-update leaves proxy dead after npm EPERM on bun binary replacement #281). - Optional: persist one unsanitized (local-only)
npmstderr excerpt under~/.opencodex/when the updater sanitizes the job log, so field diagnosis does not require a manual repro.
Checks
- I searched existing issues and documentation.
- I removed secrets, tokens, account details, request credentials, and personal data.
Activity
fix: keep fenced proxies restartable and failed Windows updates recov…
lidge-jun commentedon Sep 23, 2026
Landed on dev in 41ba802 via #5643: the updater now handles leftover rename-aside directories and locked files it owns from an earlier attempt, never deletes leftovers it does not own, keeps the previous install and service when a step fails, and prints the recovery command; the docs gained a troubleshooting page for failed updates. An updater already installed on an older version cannot be changed retroactively, so that page covers the manual path from those versions. Closing manually since dev merges do not auto-close; please reopen if the current updater still fails this way.