Plugin installation failures are silent, causing OAuth options to disappear
Description
Problem
When built-in OAuth plugins (opencode-copilot-auth, opencode-anthropic-auth) fail to install from npm, the error is logged but execution continues silently. Users are left without OAuth authentication options and no indication of what went wrong.
Impact
- User confusion: OAuth options mysteriously missing for GitHub Copilot, Anthropic, etc.
- Enterprise environments: Particularly affects users with corporate npm proxies (JFrog, Artifactory, Nexus)
- Silent failures: Users have no visibility into why authentication methods are unavailable
Root cause
Location: packages/opencode/src/plugin/index.ts:58-75
plugin = await BunProc.install(pkg, version).catch((err) => {
if (!builtin) throw err
const message = err instanceof Error ? err.message : String(err)
log.error("failed to install builtin plugin", {
pkg,
version,
error: message,
})
Bus.publish(Session.Event.Error, {
error: new NamedError.Unknown({
message: `Failed to install built-in plugin ${pkg}@${version}: ${message}`,
}).toObject(),
})
return "" // ⚠️ Returns empty string on failure
})
if (!plugin) continue // ⚠️ Silently skips failed plugin
When builtin plugins fail to install:
- Error is logged to console (users rarely see this)
- Session.Event.Error is published (not displayed in UI)
- Plugin is silently skipped with continue
- ProviderAuth.methods() returns no OAuth methods for that provider
- UI falls back to API key only with no explanation
Plugins
opencode-copilot-auth, opencode-anthropic-auth
OpenCode version
1.1.17
Steps to reproduce
Reproduction Steps
-
Set up environment to cause npm install failure:
Example: point to invalid registry
npm config set registry https://invalid-registry.example.com/
-
Start OpenCode: opencode
-
Try to authenticate with GitHub Copilot: opencode auth login
Select "github-copilot"
Only see "API key" option, no OAuth
You might need to clear old auth configs
-
No error message or indication of why OAuth is missing
Expected Behavior
When plugins fail to install, users should:
- See a clear warning message explaining the problem
- Get actionable steps to fix the issue
- Have diagnostic tools to troubleshoot
- Understand which authentication methods are unavailable and why
Screenshot and/or share link
Operating System
No response
Terminal
No response