Repository navigation
Description
Environment
- OpenClaw
2026.7.1(2d2ddc4), npm install path - Two hosts: Ubuntu 24.04 (aarch64 VM) and macOS (arm64)
- Node
v24.18.0on both - npm 11.x on both (so [Bug]: npm 12 breaks every plugin npm operation ("npm view produced incomplete package metadata"); failure path then disables healthy plugins #106189's npm-12 root cause does not apply)
Summary
After openclaw plugins update @openclaw/<external-plugin> fails to write its install record cleanly on 2026.7.1, attempting any follow-up install --force, uninstall, or even registry --refresh aborts with:
[openclaw] Could not start the CLI.
[openclaw] Reason: ENOTDIR: not a directory, scandir '/home/<user>/.openclaw/openclaw.json'
The CLI is calling scandir() on the openclaw.json file as if it were a directory, which predictably fails. The bug renders the plugin uninstallable/installable until manual cleanup of stale state.
Steps to reproduce
- Have a healthy
@openclaw/<external-plugin>plugin installed (Tavily used here; pattern reproduces on any npm-installed official external plugin). - Run
openclaw plugins update @openclaw/<external-plugin>@2026.7.1. The CLI claims success (Updated tavily: 2026.6.11 -> 2026.7.1) but a NEW project dir appears at~/.openclaw/npm/projects/<name>-<hash>__openclaw-generation__g-<newhash>/while the OLD project dir at~/.openclaw/npm/projects/<name>-<hash>/is left untouched.installed_plugin_indexin SQLite accumulates BOTH records. - Run
openclaw plugins registry --refresh. CLI exits with the ENOTDIR error. Plugin registry still shows the old version, gateway continues to load the old install path. rm -rf ~/.openclaw/npm/projects/<name>-<hash>/(clean up the stale OLD project dir manually).- Run
openclaw plugins install @openclaw/<external-plugin>@2026.7.1 --force. CLI aborts with ENOTDIR before writing the new install record. - Run
openclaw plugins uninstall <plugin>. CLI aborts with ENOTDIR. (uninstallwithout--forcerequires an interactive TTY and errors in non-TTY SSH.) - Symlink the OLD path to the NEW path:
ln -s <newhash-dir> <hash-dir>. Registry refresh still drops the plugin ("not installed"). Plugin is now completely untracked and cannot be re-registered. - The interactive
openclaw gateway installwizard hits the same ENOTDIR on the Tavily install step.
Expected
Plugin install/update should either write the install record successfully (and replace any stale install path silently), or fail loudly with a clear message specifically about plugin install state. The CLI should tolerate rm -rf'd stale install paths gracefully on subsequent operations.
Actual
CLI exits with ENOTDIR: not a directory, scandir '/home/<user>/.openclaw/openclaw.json' for every install/update/uninstall/registry-refresh operation once a stale install path is removed.
Error output
$ openclaw plugins install @openclaw/tavily-plugin@2026.7.1 --force
Installing @openclaw/tavily-plugin@2026.7.1 into /home/<user>/.openclaw/npm/projects/openclaw-tavily-plugin-<hash>__openclaw-generation__g-<newhash>…
Plugin manifest id "tavily" differs from npm package name "@openclaw/tavily-plugin"; using manifest id as the config key.
[openclaw] Could not start the CLI.
[openclaw] Reason: ENOTDIR: not a directory, scandir '/home/<user>/.openclaw/openclaw.json'
[openclaw] Debug: set OPENCLAW_DEBUG=1 to include the stack trace.
[openclaw] Try: openclaw doctor
[openclaw] Help: openclaw --help
Workarounds attempted (none work)
openclaw plugins registry --refresh(re-reads stale path; no recovery)openclaw plugins install --force(still hits ENOTDIR)openclaw plugins uninstall <plugin>(needs interactive TTY; fails in non-TTY SSH)openclaw doctor --fix(does not repair this state; reports drift but offers no actionable recovery)- Symlinking the OLD path to the NEW generation dir (registry refresh still drops the plugin)
- chattr +i was toggled off and back on; reproduction is unaffected by config protection
Workarounds that work (interim)
- Leave the plugin un-installed; gateway falls back to other configured providers (Ollama search, etc.).
- Manual edit of
installed_plugin_index(the SQLite row'sinstall_records_jsonJSON column) to point at the new install path — viable but not documented or supported.
Related
- [Bug]: npm 12 breaks every plugin npm operation ("npm view produced incomplete package metadata"); failure path then disables healthy plugins #106189 — npm 12 plugin operation failures, P0. Same plugin-dies-after-install pattern but different specific error string. We were on npm 11.x, so this is a distinct symptom in the same 7.1 cluster.
- [Bug]: msteams plugin npm install can leave an empty dependency tree — plugin loads, provider dies silently, Microsoft sees delivery errors #101049 — msteams plugin npm install leaves empty dependency tree. Notes the same
__openclaw-generation__g-<hash>project dir naming convention, suggesting the same install path generation code is implicated. doctor --fixsilently drops theplugins.allowentry for a bundled→externalized plugin (codex), unregistering the agent harness — and the gateway still reports healthy #107226 —doctor --fixsilently dropsplugins.allowentry for a bundled→externalized plugin (filed today, 2026-07-14).- 2026.7.1 startup-migration gate is fatal, but the repair path (
openclaw doctor) doesn't resolve the conflict — gateway crash-loops with no documented remedy #107227 — 2026.7.1 startup-migration gate fatal;doctorrepair path does not cover this case (filed today).
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jul 14, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 14, 2026, 12:27 PM ET / 16:27 UTC.
Summary
Keep open: this is a credible cross-platform v2026.7.1 regression that blocks all plugin lifecycle operations and setup after managed npm install metadata drifts; current main still propagates ENOTDIR from the managed-project scan, and no merged fix or release provenance establishes that the reported recovery failure is resolved.
Reproducibility: yes. for the shipped regression path: the report provides repeatable Ubuntu and macOS steps, and current source contains the matching uncaught ENOTDIR scan path. A destructive current-main live reproduction and stack trace have not yet been captured.
Next step
The regression is concrete and bounded enough for one repair PR, but implementation must first capture the current-main stack and verify whether ENOTDIR is the root defect or a symptom of corrupted path provenance.
Review details
Best possible solution:
Make the managed npm update transaction replace the authoritative install record only after the new generation validates, clean obsolete generations after commit, and let
openclaw doctor --fixplus a visible setup Fix action reconcile stale or missing paths without manual SQLite editing.Do we have a high-confidence way to reproduce the issue?
Yes for the shipped regression path: the report provides repeatable Ubuntu and macOS steps, and current source contains the matching uncaught ENOTDIR scan path. A destructive current-main live reproduction and stack trace have not yet been captured.
Is this the best way to solve the issue?
Yes, a bounded repair of managed npm path derivation, atomic install-index replacement, stale-generation cleanup, and Doctor recovery is the narrowest maintainable solution; swallowing ENOTDIR alone would not be sufficient.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against 6f0326af3642.
Label changes
Label changes:
P0: A routine shipped plugin update can leave plugin management and the interactive setup flow unusable, with recovery requiring manual filesystem or SQLite surgery.impact:data-loss: The reported update accumulates conflicting persisted install records and can leave the plugin untracked after stale-path cleanup.impact:ux-release-blocker: Plugin setup and recovery are blocked with no working in-product repair path; the successful workaround requires unsupported manual SQLite editing.issue-rating: 🐚 platinum hermit: Current issue advisory state selects this label.clawsweeper:needs-live-repro: Current issue advisory state selects this label.clawsweeper:queueable-fix: Current issue advisory state selects this label.clawsweeper:fix-shape-clear: Current issue advisory state selects this label.Label justifications:
P0: A routine shipped plugin update can leave plugin management and the interactive setup flow unusable, with recovery requiring manual filesystem or SQLite surgery.impact:data-loss: The reported update accumulates conflicting persisted install records and can leave the plugin untracked after stale-path cleanup.impact:ux-release-blocker: Plugin setup and recovery are blocked with no working in-product repair path; the successful workaround requires unsupported manual SQLite editing.Evidence reviewed
Acceptance criteria:
What I checked:
src/plugins/install.ts, 6f0326af3642)src/plugins/install-paths.ts, 6f0326af3642)docs/cli/plugins.md. (docs/cli/plugins.md:415, 6f0326af3642)docs/cli/plugins.md. (docs/cli/plugins.md:477, 6f0326af3642)VISION.md:2, 6f0326af3642)CHANGELOG.md, 2d2ddc43d0dc)Likely related people:
src/plugins/install.ts,src/plugins/install-paths.ts,src/infra/npm-managed-root.ts)src/infra/npm-managed-root.ts,src/plugins/install.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.fix: prevent stale plugin installs from blocking lifecycle commands (#…
fix: prevent stale plugin installs from blocking lifecycle commands (o…
fix: prevent stale plugin installs from blocking lifecycle commands (o…