anomalyco / anomalyco/opencode

Merge Gateway provider fails to initialize when the runtime npm install fails

Open
#47,069 1 comment 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Sep 3, 2026.

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

Description

Description

Merge Gateway is a registry provider whose npm package (merge-gateway-ai-sdk-provider) is not in BUNDLED_PROVIDERS, so opencode installs it from npm at runtime on first message. On machines where that install fails (proxy, registry config, offline cache), every message errors with Failed to initialize provider: merge-gateway, while bundled providers like @ai-sdk/anthropic keep working. Regenerating API keys, reconnecting, or restarting doesn't help since none of that touches the npm step. Reported by a Merge Gateway user via support (I work at Merge).

Plugins

None

OpenCode version

Reproduced on current dev from source

Steps to reproduce
  1. rm -rf ~/.cache/opencode/packages
  2. Make the npm registry unreachable, e.g. export npm_config_registry=http://127.0.0.1:9
  3. Send any message with a merge-gateway/* model
  4. Failed to initialize provider: merge-gateway on every message; anthropic/openai providers still work

Fix proposed in #46484: bundle the provider like venice/gitlab/openrouter.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.