diegosouzapw/OmniRoute · error
gheUrl is required for GHE Copilot OAuth
Error message
gheUrl is required for GHE Copilot OAuth
What it means
normalizeGheUrl() in the GHE Copilot provider: the per-connection gheUrl value is missing, not a string, or blank. Every GHE endpoint (device code, token, user info) is derived from it, so the flow cannot proceed without it.
Solutions
- Set the GitHub Enterprise URL on the connection before authorizing
- Validate gheUrl presence in the UI before offering the OAuth button
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/lib/oauth/providers/ghe-copilot.ts:15 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/8844dd12eef14025.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/oauth/providers/ghe-copilot.ts:15
import { GHE_COPILOT_CONFIG } from "../constants/oauth";
import { sanitizeErrorMessage } from "@omniroute/open-sse/utils/error";
/**
* GHE Copilot OAuth provider.
*
* Reuses the GitHub device-code flow but targets the GitHub Enterprise host
* configured per-connection via `gheUrl` (stored in providerSpecificData).
* The device-code / token / user-info / copilot-token endpoints are derived
* from gheUrl at request time.
*/
function normalizeGheUrl(value: unknown): string {
if (typeof value !== "string" || !value.trim()) {
throw new Error("gheUrl is required for GHE Copilot OAuth");
}
return value.trim().replace(/\/+$/, "");
}
export const gheCopilot = {
config: GHE_COPILOT_CONFIG,
flowType: "device_code" as const,
requestDeviceCode: async (config: any) => {
const gheUrl = normalizeGheUrl(config.gheUrl);
const response = await fetch(`${gheUrl}/login/device/code`, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Accept: "application/json",
},
body: new URLSearchParams({
client_id: config.clientId,
scope: config.scopes,View on GitHub (pinned to a179ffed5b)