Skip to content

Plugin install fails with valid proxy env: fetch() proxy.url must be a non-empty string #21468

@vanish1984

Description

@vanish1984

Description

Summary

When plugin is configured with a package name such as oh-my-openagent, OpenCode 1.4.0 fails during plugin installation on macOS with:

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

The proxy environment in the shell is valid. As a result the plugin is not loaded, custom agents are not registered, and OpenCode falls back to the default agent.

Environment

  • OpenCode: 1.4.0
  • OS: macOS
  • Node.js: v22.21.1
  • Bun: 1.3.6
  • Proxy env in shell:
    • http_proxy=http://127.0.0.1:7890
    • https_proxy=http://127.0.0.1:7890

Reproduction

  1. Configure OpenCode with a package-name plugin entry:
{
  "plugin": ["oh-my-openagent"]
}
  1. Ensure the shell has valid proxy vars set, for example:
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
  1. Run:
opencode --print-logs run --agent sisyphus "return exactly: plugin-check-ok"

Expected

OpenCode should install or load the plugin successfully and the sisyphus agent should be available.

Actual

OpenCode logs:

INFO  service=plugin path=oh-my-openagent loading plugin
INFO  service=npm pkg=oh-my-openagent@latest installing package
ERROR service=plugin pkg=oh-my-openagent version=latest error=request to https://registry.npmjs.org/oh-my-openagent failed, reason: fetch() proxy.url must be a non-empty string failed to install plugin
!  agent "sisyphus" not found. Falling back to default agent

Additional checks

  • Reproduces even after explicitly source ~/.zshrc in a fresh zsh process.
  • Reproduces even when injecting npm_config_proxy and npm_config_https_proxy directly into the opencode command environment.
  • Shell proxy variables are present and non-empty.
  • Direct package usage via local filesystem path works immediately.

Workaround

Use a local filesystem path in the plugin array instead of the package name:

{
  "plugin": ["/Users/.../.cache/opencode/node_modules/oh-my-openagent"]
}

With the local path, sisyphus loads correctly and runs.

Question

It looks like the package-install code path is constructing or reading a proxy config object with an empty url, even though valid proxy env vars exist in the parent shell. Could you check the plugin installer proxy resolution logic in 1.4.0?

Plugins

oh-my-openagent

OpenCode version

1.4.0

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything 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