Skip to content

Plugin install via npm fails behind proxy with 'fetch() proxy.url must be a non-empty string' #21098

@WSXYT

Description

@WSXYT

Description

OpenCode fails to install an npm plugin when proxy environment variables are present.

In my case, trying to load oh-my-openagent through the normal plugin spec caused OpenCode to attempt an npm install and fail with:

request to https://registry.npmjs.org/oh-my-openagent failed, reason: fetch() proxy.url must be a non-empty string

and later also:

request to https://registry.npmjs.org/zod/-/zod-4.3.6.tgz failed, reason: fetch() proxy.url must be a non-empty string

This happened while the shell environment had:

http_proxy=http://127.0.0.1:7897
https_proxy=http://127.0.0.1:7897
all_proxy=socks5://127.0.0.1:7897

The failure happens during OpenCode's plugin install path, not because the plugin package itself is bad.

A working workaround was to avoid the npm/plugin install path entirely and point OpenCode at a locally installed plugin directory instead of using a package spec.

So this looks like an upstream proxy handling bug in OpenCode's plugin install/npm fetch path.

Plugins

oh-my-openagent

OpenCode version

1.3.15

Steps to reproduce

  1. Set proxy environment variables, for example:
    export http_proxy=http://127.0.0.1:7897
    export https_proxy=http://127.0.0.1:7897
    export all_proxy=socks5://127.0.0.1:7897
  2. Configure an npm-backed plugin in ~/.config/opencode/opencode.json, for example:
    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["oh-my-openagent"]
    }
  3. Start opencode
  4. Observe plugin installation attempt in logs
  5. Observe failure fetching from registry.npmjs.org with:
    fetch() proxy.url must be a non-empty string
    

Screenshot and/or share link

N/A

Operating System

Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 GNU/Linux

Terminal

xterm-256color (WSL)

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions