NousResearch/hermes-agent · warning · Error
OAuth authorization window was closed before completion
Error message
OAuth authorization window was closed before completion
What it means
The OAuth polling loop noticed authWindow.closed while the flow was still neither approved nor errored — the user closed the authorization popup before finishing consent. Since consent can never complete without that window, the flow is aborted immediately rather than polling forever.
Source
Thrown at web/src/lib/mcp-dashboard-oauth.ts:62
let pollFailures = 0;
for (;;) {
let current: McpOAuthFlow;
try {
current = await status(started.flow_id);
pollFailures = 0;
} catch (error) {
pollFailures += 1;
if (pollFailures >= maxPollFailures) throw error;
await sleep(1000);
continue;
}
if (current.status === "approved") return current;
if (current.status === "error") {
throw new Error(current.error || "OAuth authorization failed");
}
if (authWindow.closed) {
throw new Error("OAuth authorization window was closed before completion");
}
await sleep(1000);
}
}
View on GitHub (pinned to c896c09c42)
Solutions
- Click the OAuth button again and complete consent in the newly opened popup without closing it.
- Disable tab/popup managers for the dashboard origin if they auto-close popups.
- If the provider page itself crashes, troubleshoot that MCP server's OAuth endpoint separately.
Defensive patterns
Strategy: try-catch
Try / catch
try {
await completeMcpDashboardOAuth({ serverName, start, status, open })
} catch (err) {
if (String(err).includes('closed before completion')) {
toast('The OAuth window was closed — click connect again to restart')
return
}
throw err
} Prevention
- Tell users (inline near the button) that a popup will open and must stay open.
- Detect the closed window quickly (the poll loop does) and offer one-click restart.
- Keep popup managers/extensions disabled for the dashboard origin.
When it happens
Trigger: User manually closes the OAuth popup mid-flow; a popup-crushing browser extension or tab manager closes it; the provider's page crashes the popup; or the OS/browser reclaims the window on navigation.
Common situations: Users closing the 'extra window' thinking it's an ad; popup managers; slow provider pages where users give up.
Related errors
- OAuth popup was blocked — allow popups for this dashboard an
- OAuth failed to start
- OAuth server did not provide an authorization URL
- OAuth authorization failed
- File uploads are not supported against OAuth-gated remote ba
AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14).
Data as JSON: /api/errors/bd47b5c532033269.
Report an issue: GitHub.