can1357/oh-my-pi · info · Error

Smithery authorization cancelled.

Error message

Smithery authorization cancelled.

What it means

Thrown by #waitForSmitheryCliApiKey when the loop exits because the abort signal fired (signal.aborted) before the authorization session completed — the pending authorization was cancelled rather than timed out or failed. In practice this represents the user or the caller aborting the wait for browser approval.

Source

Thrown at packages/coding-agent/src/modes/controllers/mcp-command-controller.ts:2427

			}
			let response: SmitheryCliPollResponse;
			try {
				response = await pollSmitheryCliAuthSession(sessionId, signal);
			} catch (error) {
				// A single hung/slow poll aborts with TimeoutError; retry until the deadline.
				if (isTimeoutError(error)) continue;
				throw error;
			}
			if (response.status === "success" && response.apiKey) {
				return response.apiKey;
			}
			if (response.status === "error") {
				throw new Error(response.message ?? "Smithery authorization failed.");
			}
			await Bun.sleep(pollIntervalMs);
		}

		throw new Error("Smithery authorization cancelled.");
	}

	async #handleSmitheryBrowserLogin(): Promise<boolean> {
		const session = await createSmitheryCliAuthSession();
		const fallbackLoginUrl = getSmitheryLoginUrl();
		this.#showMessage(
			[
				"",
				theme.bold("Smithery Login"),
				theme.fg("muted", "Browser authorization started. Complete auth in your browser."),
				theme.fg("dim", "Authorize URL:"),
				theme.fg("accent", session.authUrl),
				theme.fg("dim", `Fallback: ${fallbackLoginUrl}`),
				"",
			].join("\n"),
		);
		try {
			openPath(session.authUrl);

View on GitHub (pinned to 9690622007)

Solutions

  1. Re-run /mcp smithery-login and keep the prompt open until browser authorization completes.
  2. If you intentionally cancelled, nothing to fix — restart the login when ready.
  3. Use the API-key path instead if interactive waiting is impractical: paste a Smithery API key when prompted.
Defensive patterns

Strategy: try-catch

Validate before calling

// Only start the wait if you can keep the UI open; check for an existing abort before polling
if (controller.signal.aborted) return; // don't start a login you'll immediately cancel

Type guard

function isAuthCancelled(err: unknown): err is Error {
  return err instanceof Error && err.message === "Smithery authorization cancelled.";
}

Try / catch

try {
  await smitheryLogin();
} catch (err) {
  if (isAuthCancelled(err)) {
    return; // user cancelled — treat as a no-op, not a failure
  }
  throw err;
}

Prevention

When it happens

Trigger: The AbortSignal passed to the polling loop aborts while the Smithery auth session is still pending — e.g. the user cancels the login prompt (Esc) or the invoking operation tears down and aborts the controller while browser authorization is awaited.

Common situations: User pressed Esc / cancelled the /mcp smithery-login flow while the browser tab was still pending; leaving the MCP command menu mid-login; session shutdown aborting in-flight prompts.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/518d7a658ddcbcbc. Report an issue: GitHub.