GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — @npmcli/arborist in Bun runtime fails to resolve proxy env vars: proxy.url must be a non-empty string · Issue #21472 · anomalyco/opencode

@npmcli/arborist in Bun runtime fails to resolve proxy env vars: proxy.url must be a non-empty string #21472

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
@npmcli/arborist in Bun runtime fails to resolve proxy env vars: proxy.url must be a non-empty string#21472
Copy link
Assignees
rekram1-node

Description

@listen0406
listen0406
opened on Apr 8, 2026
Issue body actions

Description

Starting from opencode 1.4.0, the plugin installer was switched from spawning bun add as a subprocess to using @npmcli/arborist directly inside the Bun runtime. When proxy environment variables (HTTP_PROXY/HTTPS_PROXY) are set, Arborist.reify() triggers an internal fetch that crashes with:
TypeError: proxy.url must be a non-empty string
This makes all remote npm plugins fail to install on startup. The issue does not occur when:

  • Running bun add or npm install as a standalone subprocess (they correctly read proxy env vars)
  • No proxy env vars are set
    The proxy environment is valid and functional — curl -x http://127.0.0.1:7897 https://registry.npmjs.org/ returns 200 OK. The issue is specific to Arborist running inside Bun's fetch implementation, which fails to parse the proxy variables correctly.
    Root Cause Analysis
    In packages/opencode/src/npm/index.ts, Npm.add() creates an Arborist instance and calls reify(), which internally uses fetch() to download packages from the npm registry. Bun's fetch() has a known issue with proxy environment variable handling — it reads the variables but fails to construct a valid proxy URL internally, resulting in the "non-empty string" error.
    Regression
    This is a regression from opencode 1.3.x which used service=bun (bun add subprocess) for plugin installation. The subprocess correctly inherited and used proxy env vars.

Plugins

  • oh-my-openagent@latest (v3.15.3, 16 dependencies) - opencode-antigravity-auth@latest (v1.6.0) - openviking-opencode@latest (v0.3.3)

OpenCode version

v1.4.0

Steps to reproduce

  1. Set proxy environment variables in a WSL2 or Linux environment:
    export HTTP_PROXY=http://127.0.0.1:7897
    export HTTPS_PROXY=http://127.0.0.1:7897
    2. Ensure proxy is reachable: curl -x http://127.0.0.1:7897 https://registry.npmjs.org/ returns 200
  2. Configure any remote npm plugin in ~/.config/opencode/opencode.json:
    { plugin: [some-plugin@latest] }
  3. Clear the plugin cache (or use a plugin not yet cached):
    rm -rf ~/.cache/opencode/packages/some-plugin@latest/*
  4. Start opencode
  5. Observe error in log (~/.local/share/opencode/log/.log):
    "service":"npm" error: "NpmInstallFailedError: ... cause: TypeError: proxy.url must be a non-empty string"

Screenshot and/or share link

No response

Operating System

ubuntu22.04 wsl in win 11

Terminal

No response

Reacted by johnsonsleo, lehhair, Yi and JiWei

Activity

  1. listen0406
    added
    bugSomething isn't working
    on Apr 8, 2026
  2. github-actions
    assigned
    rekram1-node
    on Apr 8, 2026
  3. github-actions
    added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    windows
    on Apr 8, 2026
  4. github-actions commented on Apr 8, 2026

    @github-actions
    github-actionsBot
    on Apr 8, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue might be a duplicate of existing issues. Please check:

    • Plugin install via npm fails behind proxy with 'fetch() proxy.url must be a non-empty string' #21098: Plugin install via npm fails behind proxy with 'fetch() proxy.url must be a non-empty string' (same error, same proxy env scenario, WSL2/Linux)
    • Plugin install fails with valid proxy env: fetch() proxy.url must be a non-empty string #21468: Plugin install fails with valid proxy env: fetch() proxy.url must be a non-empty string (same root cause, macOS)
    • Plugin installation fails: "fetch() proxy.url must be a non-empty string" even with proxy disabled #21327: Plugin installation fails: "fetch() proxy.url must be a non-empty string" even with proxy disabled (same error)

    Please review those threads before continuing — especially #21098 which has active discussion and 13 comments.

  5. skywalker-35 commented on Apr 18, 2026

    @skywalker-35
    skywalker-35
    on Apr 18, 2026
    More actions

    Additional report: Windows 11 without any proxy — same error

    Environment

    OS Windows 11 Pro
    opencode 1.4.11
    Node v22.22.2
    npm 10.9.7
    Proxy None — HTTP_PROXY / HTTPS_PROXY not set, no system proxy

    Symptom

    Every startup reports:

    Failed to install plugin [email protected]: NpmInstallFailedError
    Failed to install plugin [email protected]: NpmInstallFailedError
    

    This bug is not proxy-specific. It reproduces on Windows with no proxy configured at all.

    Root cause narrowed down

    Through direct testing:

    • Running @npmcli/arborist loadVirtual() against the same cache directory under Node.js v22: succeeds — edgesOut is populated, reify is correctly skipped
    • Same call inside 1.4.11's embedded Bun runtime: loadVirtual() throws (silently swallowed by .catch(() => {})), falls through to reify(), which then fails and raises NpmInstallFailedError

    The root cause is Bun runtime incompatibility with @npmcli/arborist's loadVirtual(), not proxy handling.

    Regression confirmed

    • [email protected] (uses bun add subprocess): works fine
    • [email protected] (uses embedded arborist): fails on every startup

    Workaround

    Downgrade to 1.3.17, install plugins with explicit versions (opencode plugin [email protected] --global), then upgrade back to 1.4.11. The warning banners still appear on startup but plugins may still load depending on timing — not a reliable fix.

    Hope this helps narrow down the Bun-side compatibility issue.

  6. skywalker-35 commented on Apr 28, 2026

    @skywalker-35
    skywalker-35
    on Apr 28, 2026
    More actions

    Still reproducing on v1.14.28 (Windows 11, no proxy)

    Environment

    OS Windows 11 Pro
    opencode v1.14.28
    Node v22.22.2 (via fnm)
    Bun v1.3.10
    Proxy None

    Reproduction steps

    1. Plugins were loading fine with cached versions ([email protected], [email protected]) installed via opencode 1.3.17
    2. Updated config to [email protected] (from "oh-my-openagent" without version)
    3. Restarted opencode → NpmInstallFailedError returned

    Workaround that worked

    Changed opencode.jsonc to pin the exact version: "[email protected]" (instead of bare "oh-my-openagent"). After that, opencode resolved the already-cached oh-my-openagent@latest directory (which contained 3.17.6) successfully.

    Key insight: The bug only manifests when opencode needs to install/reify a new plugin version. If the cache already exists and loadVirtual() succeeds against it (returns populated edgesOut), the buggy reify() path is skipped and everything works. This is why some users report "it works for me" — they happen to have a compatible cache from a previous install.

    Additional issue: resolveEntryPoint() without a version number doesn't reliably resolve to @latest. It sometimes picks up an older fixed-version cache (@3.17.4) instead of @latest (@3.17.6). Pinning the version in config is necessary.

  7. thdxr
    removed
    bugSomething isn't working
    windows
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  8. github-actions commented on Jul 6, 2026

    @github-actions
    github-actionsBot
    on Jul 6, 2026 – with GitHub Actions
    Contributor
    More actions

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  9. github-actions
    closed this as not plannedon Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.