opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Plugin installation failures are silent, causing OAuth options to disappear

Open Barneyjm opened this issue 1 day ago • 4 comments

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:

  1. Error is logged to console (users rarely see this)
  2. Session.Event.Error is published (not displayed in UI)
  3. Plugin is silently skipped with continue
  4. ProviderAuth.methods() returns no OAuth methods for that provider
  5. 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

  1. Set up environment to cause npm install failure:

    Example: point to invalid registry

    npm config set registry https://invalid-registry.example.com/

  2. Start OpenCode: opencode

  3. 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

  4. No error message or indication of why OAuth is missing

Expected Behavior

When plugins fail to install, users should:

  1. See a clear warning message explaining the problem
  2. Get actionable steps to fix the issue
  3. Have diagnostic tools to troubleshoot
  4. Understand which authentication methods are unavailable and why

Screenshot and/or share link

Image

Operating System

No response

Terminal

No response

Barneyjm avatar Jan 13 '26 23:01 Barneyjm