{"record":{"id":"518d7a658ddcbcbc","repo":"can1357/oh-my-pi","slug":"smithery-authorization-cancelled","errorCode":null,"errorMessage":"Smithery authorization cancelled.","messagePattern":"Smithery authorization cancelled\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"info","filePath":"packages/coding-agent/src/modes/controllers/mcp-command-controller.ts","lineNumber":2427,"sourceCode":"\t\t\t}\n\t\t\tlet response: SmitheryCliPollResponse;\n\t\t\ttry {\n\t\t\t\tresponse = await pollSmitheryCliAuthSession(sessionId, signal);\n\t\t\t} catch (error) {\n\t\t\t\t// A single hung/slow poll aborts with TimeoutError; retry until the deadline.\n\t\t\t\tif (isTimeoutError(error)) continue;\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tif (response.status === \"success\" && response.apiKey) {\n\t\t\t\treturn response.apiKey;\n\t\t\t}\n\t\t\tif (response.status === \"error\") {\n\t\t\t\tthrow new Error(response.message ?? \"Smithery authorization failed.\");\n\t\t\t}\n\t\t\tawait Bun.sleep(pollIntervalMs);\n\t\t}\n\n\t\tthrow new Error(\"Smithery authorization cancelled.\");\n\t}\n\n\tasync #handleSmitheryBrowserLogin(): Promise<boolean> {\n\t\tconst session = await createSmitheryCliAuthSession();\n\t\tconst fallbackLoginUrl = getSmitheryLoginUrl();\n\t\tthis.#showMessage(\n\t\t\t[\n\t\t\t\t\"\",\n\t\t\t\ttheme.bold(\"Smithery Login\"),\n\t\t\t\ttheme.fg(\"muted\", \"Browser authorization started. Complete auth in your browser.\"),\n\t\t\t\ttheme.fg(\"dim\", \"Authorize URL:\"),\n\t\t\t\ttheme.fg(\"accent\", session.authUrl),\n\t\t\t\ttheme.fg(\"dim\", `Fallback: ${fallbackLoginUrl}`),\n\t\t\t\t\"\",\n\t\t\t].join(\"\\n\"),\n\t\t);\n\t\ttry {\n\t\t\topenPath(session.authUrl);","sourceCodeStart":2409,"sourceCodeEnd":2445,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/modes/controllers/mcp-command-controller.ts#L2409-L2445","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-run /mcp smithery-login and keep the prompt open until browser authorization completes.","If you intentionally cancelled, nothing to fix — restart the login when ready.","Use the API-key path instead if interactive waiting is impractical: paste a Smithery API key when prompted."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Only start the wait if you can keep the UI open; check for an existing abort before polling\nif (controller.signal.aborted) return; // don't start a login you'll immediately cancel","typeGuard":"function isAuthCancelled(err: unknown): err is Error {\n  return err instanceof Error && err.message === \"Smithery authorization cancelled.\";\n}","tryCatchPattern":"try {\n  await smitheryLogin();\n} catch (err) {\n  if (isAuthCancelled(err)) {\n    return; // user cancelled — treat as a no-op, not a failure\n  }\n  throw err;\n}","preventionTips":["Don't press Esc / close the MCP menu while browser authorization is pending.","Complete the browser step before navigating away from the command.","Treat this error as an intentional cancel and simply restart /mcp smithery-login when ready."],"tags":["smithery","authentication","cancelled","abort"],"backgroundTag":"authorization-cancelled","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}