anomalyco / anomalyco/opencode
Merge Gateway provider fails to initialize when the runtime npm install fails
@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
rm -rf ~/.cache/opencode/packages- Make the npm registry unreachable, e.g.
export npm_config_registry=http://127.0.0.1:9 - Send any message with a
merge-gateway/*model Failed to initialize provider: merge-gatewayon every message; anthropic/openai providers still work
Fix proposed in #46484: bundle the provider like venice/gitlab/openrouter.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.