Skip to content

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

Open

Description

@auinternettv-gib

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 install → succeeds (131 packages; npm 11.19.0, node v24.20.0; only EBADENGINE warnings for @opentui/core).
  3. opencode plugin add [email protected] → succeeds 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/[email protected] → solid-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 [email protected] (pinned entry) + opencode plugin remove opencode-sdd-engram-manage (drop the unversioned entry).

Activity

  1. CENFARG commented on Oct 16, 2026

    @CENFARG

    Cross-platform + current-version data point confirming this (Windows 11, opencode 2.0.30, node 24.14.1):

    • Bare entry in cli.json fails identically: NpmInstallFailedError (cause: Error: unable to resolve dependency tree) at Npm.reify, reconciling on every start. [email protected] and @1.6.8 (exact) both install fine through OpenCode — so only the tag spec path fails, matching your 1.6.8 observation and extending it to the latest release.
    • Differential harness with opencode's own installer stack (@npmcli/[email protected], empty staging dir, reify({add: [spec]}, audit:false, ignoreScripts:true, binLinks:true, save:true) + @npmcli/[email protected] defaults): the tag spec succeeds standalone under both Node 24.14.1 and Bun 1.4.2. Same registry cache, same manifests — which supports your per-spec resolver/cache state hypothesis inside OpenCode's bundled client.
    • Reproduced fully isolated via XDG_CACHE_HOME/XDG_CONFIG_HOME sandbox (production config verified unchanged by hash).
    • Workaround we shipped to users: pin the exact version in config.

    Happy to test any candidate fix on Windows.

  2. diegoolherry commented on Oct 20, 2026

    @diegoolherry

    Reproduces on Windows with opencode 2.1.1, so this is still present after the 2.0.x reports.

    Environment:

    • opencode v2.1.1, channel latest, installed via npm (@opencode/cli)
    • Windows 10.0.19045 (win32 x64), Node v24.11.1, npm 11.19.0
    • Terminal: WezTerm (TERM_PROGRAM=WezTerm); shell: cmd.exe / PowerShell

    Observed:

    1. opencode plugin add opencode-sdd-engram-manage -> NpmInstallFailedError: with an empty message, exit 1. opencode plugin update opencode-sdd-engram-manage prints No plugin updates available followed by the same empty error.
    2. Server startup logs the same empty NpmInstallFailedError on both reconciliation passes (durationMs=2865, then 285) for target=opencode-sdd-engram-manage install=true role=cli.
    3. In an empty directory, {"dependencies":{"opencode-sdd-engram-manage":"1.7.0"}} + npm install succeeds (131 packages, ~22s); only EBADENGINE warnings for @opentui/[email protected] (it requires node >=26.4.0, host has 24.11.1).
    4. ~/.cache/opencode/npm/opencode-sdd-engram-manage@latest stays empty - no <epoch> staging directory is ever created - while the healthy opencode-subagent-statusline@latest/<epoch>/ is populated normally with package.json and node_modules/.
    5. Moving the stale ~/.cache/opencode/packages/opencode-sdd-engram-manage@latest aside does not help; the next attempt fails again with the same empty error.
    6. opencode plugin add [email protected] succeeds, and opencode plugin check then exits 0 with both TUI plugins reported (current).

    This confirms the per-spec resolver/cache-state diagnosis: 1.7.0 fails and 1.6.8 installs through the same code path, and the pinned-1.6.8 workaround also works on Windows.

  3. rudy500 commented on Oct 22, 2026

    @rudy500

    Still reproduces on v2.1.2 (Windows) — this issue is the closest match, adding occurrence evidence.

    • opencode plugin add opencode-sdd-engram-manage (bare name → tag spec, dist-tag latest = 1.7.0) fails deterministically, exit 1, across multiple runs:
      NpmInstallFailedError
        [cause]: Error: unable to resolve dependency tree
          at Npm.reify
      
      and startup reconciliation logs the same WARN with error=NpmInstallFailedError target=opencode-sdd-engram-manage.
    • opencode plugin add [email protected] succeeds through the identical code path (exit 0, cache generation created). The ~/.cache/opencode/npm/opencode-sdd-engram-manage@latest workspace stays empty — reproduces the empty-workspace observation above.
    • Manual npm install [email protected] with system npm succeeds in ~11s, so the tree is resolvable; same conclusion as the standalone arborist harness in the duplicate closed as plugin add with a tag spec (bare name / @latest) fails with ERESOLVE for some packages; exact version installs fine #56091.
    • Workaround confirmed for a clean startup: pin "[email protected]" in cli.json and drop the bare entry — with the bare entry kept, every TUI start retries and logs the failure again.

    Environment: opencode v2.1.2, Windows 11 (win32 x64), node v24.18.0, npm 12.2.0, registry https://registry.npmjs.org/, empty user .npmrc.

  4. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report. I can reproduce this on v2.0.10, and it still happens on the latest dev (62ae125).

    It only affects the bare spec:

    • opencode plugin add opencode-sdd-engram-manage fails with an empty NpmInstallFailedError: and [cause]: Error: unable to resolve dependency tree.
    • opencode plugin add opencode-sdd-engram-manage@latest, @1.7.0 and @^1.7.0 all install fine.

    It looks like the cause is not per-package cache state but how a bare name is resolved. The bun runtime OpenCode runs on reports its Node version as v26.x. A bare name is resolved as the range *, and npm's version picker then skips versions whose engines.node (>=24 <25, which 1.3.0 and later declare) rules out v26. It falls back to 1.2.0, which declares no node engine but has old peers (@opentui/core ^0.1.100). Those peers conflict with the current @opentui/core, and that's the ERESOLVE. A tag or exact version skips that path, which is why pinning 1.6.8 worked for you. In the meantime, an @latest entry instead of the bare name should also work.

    The empty error message is real too: the error class has no message of its own, so the CLI shows the cause only under [cause]. I didn't test the startup-log path myself, but that would explain why your reconciliation logs show only the error name.

    The script below reproduces it.

    Reproduction script (repro.sh)
    #!/usr/bin/env bash
    # Repro for #50080: bare plugin spec fails, @latest / exact version succeed.
    # Requires: opencode (bun add -g @opencode/[email protected]) and npm on PATH.
    set -u
    OC=${OC:-opencode}
    export HOME=$(mktemp -d)   # isolated config + ~/.cache/opencode/npm
    cd "$(mktemp -d)"
    $OC --version
    bun -e 'console.log("bun-reported process.version:", process.version)' 2>/dev/null || true
    echo "engines.node of 1.7.0: $(npm view [email protected] engines.node)"
    for spec in opencode-sdd-engram-manage opencode-sdd-engram-manage@latest [email protected]; do
      echo "== opencode plugin add $spec"
      $OC plugin add "$spec" 2>&1 | grep -E "NpmInstallFailedError|cause|installed"
    done

    Run it: bash repro.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions