anomalyco / anomalyco/opencode

plugin install: TUI plugin fails with empty NpmInstallFailedError — resolver rejects a spec npm installs fine

Open
#50,080 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Summary

Every client startup fails to install the opencode-sdd-engram-manage TUI plugin (npm registry package, unversioned entry in cli.json plugins@latest = 1.7.0) with NpmInstallFailedError — an error with an empty message in the logs. The real cause (unable to resolve dependency tree at Npm.reify) only surfaces through opencode plugin add / update stderr. The identical manifest installs fine with system npm, and version 1.6.8 — with byte-identical peerDependencies/engines metadata — installs fine through OpenCode itself. The tree is resolvable; the failure looks like per-spec resolver/cache state inside OpenCode's internal npm client.

Environment

  • opencode version: v2.0.10 (also reproduces on v2.0.8)
  • OS: Linux 7.0.0-31-generic x86_64 (Ubuntu-based)
  • Terminal: TERM=xterm-256color, COLORTERM=truecolor (desktop app and TUI clients both affected)
  • Shell: /bin/bash
  • Install/channel: latest (client auto-updated 2.0.8 → 2.0.10 mid-session; server on 2.0.10)
  • Active plugins: TUI (cli.json plugins): opencode-subagent-statusline 1.3.0 (healthy), local gentle-logo.tsx (healthy), opencode-sdd-engram-manage (the failing one; now pinned @1.6.8 as workaround). Server: 92 plugins active, including 6 local plugins.

Reproduction

  1. opencode plugin add opencode-sdd-engram-manage → fails:
    NpmInstallFailedError:
        at Npm.reify (...)
        at Npm.add (...)
        at cli.plugin.add (...)
    [cause]: Error: unable to resolve dependency tree
    
  2. In an empty directory: echo '{"dependencies":{"opencode-sdd-engram-manage":"1.7.0"}}' > package.json && npm installsucceeds (131 packages; npm 11.19.0, node v24.20.0; only EBADENGINE warnings for @opentui/core).
  3. opencode plugin add opencode-sdd-engram-manage@1.6.8succeeds through the same OpenCode code path.

Expected Behavior

  • The internal installer resolves the same dependency tree that npm resolves (or reports the specific conflict).
  • When an install fails, the underlying cause is visible in CLI output and reconciliation logs — not an empty NpmInstallFailedError.

Actual Behavior

  • Deterministic failure at every client startup reconciliation (~180–470 ms, stage=prepare, install=true):
    level=WARN message="plugin operation failed" component=plugin stage=prepare
    durationMs=236 error=NpmInstallFailedError reconciliation=1
    target=opencode-sdd-engram-manage install=true role=cli
    
    with no message or cause, even with OPENCODE_LOG_LEVEL=DEBUG.
  • opencode plugin update reports [cause]: Error: Package is not installed: opencode-sdd-engram-manage.
  • The workspace ~/.cache/opencode/npm/opencode-sdd-engram-manage@latest stays completely empty — the <epoch-ms> staging directory is never created. A healthy plugin's workspace (opencode-subagent-statusline@latest) contains <epoch-ms>/package.json ({"dependencies":{"opencode-subagent-statusline":"1.3.0"}}) and <epoch-ms>/node_modules/.
  • The failure persisted across: v2.0.8 → v2.0.10, service restarts, and deleting the workspace directory (OpenCode recreated it empty and failed again).

Additional Context

  • Package metadata for 1.6.8 vs 1.7.0 is byte-identical for peerDependencies/engines (a diff of npm view --json shows only tarball hash/size/gitHead). Peers: solid-js: 1.9.12 (exact pin), @opentui/core|solid|keymap: >=0.4.2 <1, @opencode-ai/plugin: >=1.17.11; engines: node: >=24 <25, opencode: >=1.17.11. The latest @opentui/* is 0.5.11, whose own peers are compatible (@opentui/solid@0.5.11solid-js: 1.9.12).
  • Since 1.6.8 installs via OpenCode and 1.7.0 does not, with identical resolution metadata, the defect appears to be per-spec state inside OpenCode's internal npm client (resolver or cache), not the package's metadata.
  • Two distinct problems: (1) the resolver failing on a resolvable spec; (2) observability — the empty NpmInstallFailedError hides the cause from the logs entirely.
  • Workaround that restored a clean startup: opencode plugin add opencode-sdd-engram-manage@1.6.8 (pinned entry) + opencode plugin remove opencode-sdd-engram-manage (drop the unversioned entry).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Npm.reify and Npm.add entry points and the cli.plugin.add path described in the stack trace, then reproduce the failure with opencode plugin add opencode-sdd-engram-manage@1.7.0. Done means the internal installer resolves the 1.7.0 spec or reports its underlying conflict, and NpmInstallFailedError exposes the cause in CLI and reconciliation logs.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.