Skip to content

CopilotAuthException

NexusLabs.Needlr.Copilot

CopilotAuthException Class

Thrown when a Copilot request fails because the caller is not authenticated. This covers two distinct cases:

public sealed class CopilotAuthException : System.Exception

Inheritance System.Object 🡒 System.Exception 🡒 CopilotAuthException

Remarks

  1. No token configured locally.NexusLabs.Needlr.Copilot.GitHubOAuthTokenProvider could not resolve a GitHub OAuth token from any configured source (explicit option, apps.json, or environment variables). The HTTP request is never sent.

  2. Token rejected by the server.NexusLabs.Needlr.Copilot.CopilotMcpToolClient received an HTTP 401 Unauthorized or 403 Forbidden response from the Copilot MCP endpoint, indicating the supplied token is invalid, expired, or lacks the required scopes.

Callers should catch this exception to implement fallback behavior such as switching to an alternative search provider or surfacing a re-authentication prompt to the user. This is the auth analog of CopilotRateLimitException and exists so consumers do not have to string-match free-text error messages from the upstream server.

Constructors

CopilotAuthException(string) Constructor

Creates a new CopilotAuthException with the given human-readable message.

public CopilotAuthException(string message);

Parameters

message System.String

A description of the auth failure.

CopilotAuthException(string, Exception) Constructor

Creates a new CopilotAuthException wrapping the given inner exception.

public CopilotAuthException(string message, System.Exception innerException);

Parameters

message System.String

A description of the auth failure.

innerException System.Exception

The underlying exception that caused this failure.