Plugin installation failures are silent, causing OAuth options to disappear #5474

Open
opened 2026-02-16 17:53:08 -05:00 by yindo · 0 comments
Owner

Originally created by @Barneyjm on GitHub (Jan 13, 2026).

Originally assigned to: @thdxr on GitHub.

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

Originally created by @Barneyjm on GitHub (Jan 13, 2026). Originally assigned to: @thdxr on GitHub. ### 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 ```typescript 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 <img width="627" height="451" alt="Image" src="https://github.com/user-attachments/assets/e5ad17d4-3299-429c-9ce2-045af25a7967" /> ### Operating System _No response_ ### Terminal _No response_
yindo added the bug label 2026-02-16 17:53:08 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#5474