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

  1. Click the OAuth button again and complete consent in the newly opened popup without closing it.
  2. Disable tab/popup managers for the dashboard origin if they auto-close popups.
  3. 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

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


AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14). Data as JSON: /api/errors/bd47b5c532033269. Report an issue: GitHub.