{"record":{"id":"23d57926c2287deb","repo":"different-ai/openwork","slug":"authorization-for-input-connectionname-did-not","errorCode":null,"errorMessage":"Authorization for ${input.connectionName} did not finish. Complete it in the browser, then try reconnecting again.","messagePattern":"Authorization for (.+?) did not finish\\. Complete it in the browser, then try reconnecting again\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/app/src/react-app/domains/session/surface/mcp-chat-reconnect.ts","lineNumber":67,"sourceCode":"    if (!input.isScopeCurrent()) {\n      throw new Error(\"The active OpenWork Cloud account changed while reconnecting. Try again in this workspace.\")\n    }\n    try {\n      const connections = await input.listConnections()\n      if (!input.isScopeCurrent()) {\n        throw new Error(\"The active OpenWork Cloud account changed while reconnecting. Try again in this workspace.\")\n      }\n      const connection = connections.find((entry) => entry.id === input.connectionId)\n      if (connection && hasFreshMcpAuthorization(connection, input.previousConnectedAt)) return connection\n    } catch (error) {\n      if (error instanceof Error && error.message.startsWith(\"The active OpenWork Cloud account changed\")) throw error\n      // A transient list failure should not turn a successful browser callback\n      // into a false failure. Keep polling until the bounded timeout.\n    }\n    await sleep(intervalMs)\n  }\n\n  throw new Error(`Authorization for ${input.connectionName} did not finish. Complete it in the browser, then try reconnecting again.`)\n}\n","sourceCodeStart":49,"sourceCodeEnd":69,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/app/src/react-app/domains/session/surface/mcp-chat-reconnect.ts#L49-L69","documentation":"After polling for timeoutMs without finding a connection whose authorization is fresher than previousConnectedAt, waitForFreshMcpAuthorization gives up and throws this message naming the connection. It means the browser OAuth callback either never completed or the refreshed authorization never appeared in listConnections results before the deadline.","triggerScenarios":"The user abandons or blocks the browser authorization, the OAuth redirect/callback never reaches the app, listConnections keeps failing transiently for the whole window, or the connection returns but with an updatedAt/connectedAt older than previousConnectedAt (authorization not actually refreshed).","commonSituations":"Popup blocked by the browser, user closes the auth tab, slow IdP login exceeding the timeout, clock skew making the fresh check fail, or a server that doesn't update the connection timestamp.","solutions":["Complete the authorization in the browser and click Reconnect again, as the message instructs.","Allow popups for the app origin so the OAuth window can open, then retry.","Increase timeoutMs / reduce intervalMs if your IdP login reliably takes longer than the current window.","Verify the server actually bumps the connection's connected/updated timestamp on re-auth; if not, hasFreshMcpAuthorization will never pass."],"exampleFix":"// before\nconst connection = await waitForFreshMcpAuthorization({ timeoutMs: 30_000, ... });\n// after\nconst connection = await waitForFreshMcpAuthorization({ timeoutMs: 120_000, intervalMs: 1_000, ... });","handlingStrategy":"retry","validationCode":"// Verify the callback can complete before starting the wait\nif (!popupAllowedFor(appOrigin)) {\n  showToast(\"Allow popups to complete authorization\");\n  return;\n}\nawait waitForFreshMcpAuthorization(input);","typeGuard":"function isAuthTimeoutError(e: unknown, connectionName: string): e is Error {\n  return e instanceof Error && e.message.startsWith(`Authorization for ${connectionName} did not finish`);\n}","tryCatchPattern":"try {\n  await waitForFreshMcpAuthorization({ ...input, timeoutMs: 120_000, intervalMs: 1_000 });\n} catch (e) {\n  if (isAuthTimeoutError(e, input.connectionName)) {\n    showToast(\"Finish the browser authorization, then retry\");\n    return;\n  }\n  throw e;\n}","preventionTips":["Allow popups for the app origin so the OAuth window can open and complete.","Size timeoutMs generously for your IdP's login latency (manual logins can exceed 30s).","Confirm the server bumps the connection's connected/updated timestamp on re-auth, or hasFreshMcpAuthorization will never succeed.","Show the pending-auth state in the UI so users know to finish the browser step."],"tags":["oauth","timeout","mcp"],"backgroundTag":"oauth-callback-timeout","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}