Skip to content

fix: improve error messages for plugin installation failures#1

Merged
Barneyjm merged 1 commit intodevfrom
claude/fix-issue-8297-krYLb
Jan 14, 2026
Merged

fix: improve error messages for plugin installation failures#1
Barneyjm merged 1 commit intodevfrom
claude/fix-issue-8297-krYLb

Conversation

@Barneyjm
Copy link
Copy Markdown
Owner

When OAuth authentication plugins fail to install (e.g., due to
corporate npm proxy issues), users now receive:

  • Clear explanation of which authentication method is unavailable
  • Actionable troubleshooting steps (check network, verify .npmrc, etc.)
  • Detailed error information for debugging

Also adds:

  • Plugin.getFailedPlugins() function for programmatic access
  • /plugin/failed API endpoint for diagnostic purposes

Fixes anomalyco#8297

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @Barneyjm, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the handling of authentication plugin installation failures by offering users clearer, more detailed error messages that include specific troubleshooting guidance. Additionally, it introduces new mechanisms, both programmatic and via a dedicated API endpoint, to expose information about failed plugins, aiding in diagnostics and debugging.

Highlights

  • Improved Error Messages: Enhanced user-facing error messages for failed OAuth plugin installations, providing clear explanations of which authentication method is unavailable.
  • Actionable Troubleshooting: Error messages now include actionable troubleshooting steps (e.g., check network, verify .npmrc, npm config list, npm ping, proxy settings) to guide users.
  • Programmatic Access to Failed Plugins: Introduced a new Plugin.getFailedPlugins() function, allowing programmatic retrieval of details for plugins that failed to install.
  • Diagnostic API Endpoint: Added a new /plugin/failed API endpoint to provide diagnostic information about authentication plugins that failed installation, useful for debugging.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly improves the error handling for plugin installation failures by providing clearer, more actionable error messages. The addition of the getFailedPlugins function and the /plugin/failed API endpoint are excellent for diagnostics and observability. The code is well-structured and the changes are easy to follow.

I have two main suggestions. First, a minor improvement for robustness in getFailedPlugins to prevent potential mutations of the internal state. Second, and more importantly, the new tests don't seem to cover the failure scenarios they are intended for, which leaves the core error-handling logic untested. Addressing this testing gap would significantly increase confidence in the new functionality.

Comment on lines +1 to +49
import { describe, expect, test, mock } from "bun:test"

// Mock the dependencies that would cause initialization issues
mock.module("../../src/bun/index", () => ({
BunProc: {
install: async (pkg: string, _version?: string) => {
// Simulate installation failure for test packages
if (pkg.includes("test-fail")) {
throw new Error("ECONNREFUSED - simulated network failure")
}
return `/fake/path/${pkg}`
},
which: () => process.execPath,
run: async () => ({ exitCode: 0 }),
},
}))

// Import after mocks are set up
const { Plugin } = await import("../../src/plugin")

describe("Plugin.getFailedPlugins", () => {
test("returns an array", () => {
const failed = Plugin.getFailedPlugins()
expect(Array.isArray(failed)).toBe(true)
})

test("returns readonly array", () => {
const failed = Plugin.getFailedPlugins()
// TypeScript ensures this is readonly, but we can verify it's not directly mutable
expect(typeof failed).toBe("object")
})
})

describe("Plugin.FailedPlugin interface", () => {
test("has expected structure", () => {
// This tests the type at runtime by creating a mock object
const mockFailedPlugin: Plugin.FailedPlugin = {
pkg: "test-package",
version: "1.0.0",
error: "Test error message",
authMethod: "Test OAuth",
}

expect(mockFailedPlugin.pkg).toBe("test-package")
expect(mockFailedPlugin.version).toBe("1.0.0")
expect(mockFailedPlugin.error).toBe("Test error message")
expect(mockFailedPlugin.authMethod).toBe("Test OAuth")
})
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

These tests are a good start, but they don't seem to be exercising the new failure-handling logic. The mock for BunProc.install is set up to throw an error for packages containing "test-fail", but the plugin installation logic that runs when ../../src/plugin is imported only attempts to install the BUILTIN plugins, none of which trigger the failure condition.

As a result, Plugin.getFailedPlugins() will always return an empty array in these tests, and the core logic for catching errors, populating the failedPlugins list, and formatting the error message remains untested.

To properly test this functionality, you could:

  1. Mock Config.get() to return a configuration that includes a plugin designed to fail (e.g., [email protected]).
  2. Trigger the plugin installation logic again within a test case.
  3. Assert that Plugin.getFailedPlugins() now contains the expected information about the failed plugin.

This would provide confidence that the error handling and diagnostic tracking work as intended.

Comment on lines +51 to +53
export function getFailedPlugins(): readonly FailedPlugin[] {
return failedPlugins
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better encapsulation and to prevent accidental mutations from consumers of this module, it's a good practice to return a shallow copy of the internal failedPlugins array instead of a direct reference.

While the readonly return type provides compile-time safety in TypeScript, it doesn't prevent mutation at runtime from JavaScript consumers or through type assertions (as any[]). Returning a copy ensures the internal state of the Plugin module remains fully protected.

Suggested change
export function getFailedPlugins(): readonly FailedPlugin[] {
return failedPlugins
}
export function getFailedPlugins(): readonly FailedPlugin[] {
return [...failedPlugins]
}

@Barneyjm Barneyjm force-pushed the claude/fix-issue-8297-krYLb branch from 4e74986 to cb49b9d Compare January 14, 2026 00:51
When OAuth authentication plugins fail to install (e.g., due to
corporate npm proxy issues), users now receive:

- Clear explanation of which authentication method is unavailable
- Actionable troubleshooting steps (check network, verify .npmrc, etc.)
- Detailed error information for debugging

Also adds:
- `Plugin.getFailedPlugins()` function for programmatic access
- `/plugin/failed` API endpoint for diagnostic purposes

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plugin installation failures are silent, causing OAuth options to disappear

2 participants