Skip to content

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

Description

@abeldeb

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.

Activity

  1. abeldeb commented on Sep 11, 2026

    @abeldeb
    Author

    Hey @jlongster, I saw the issue was assigned to you, when you get a chance could you have a look through it and let me know what you think? thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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