{"id":"c43eea4ecf8d22ba","repo":"mongodb/node-mongodb-native","slug":"oidc-callback-timed-out-after-human-timeout-ms-m","errorCode":null,"errorMessage":"OIDC callback timed out after ${HUMAN_TIMEOUT_MS}ms.","messagePattern":"OIDC callback timed out after (.+?)ms\\.","errorType":"exception","errorClass":"MongoOIDCError","httpStatus":null,"severity":"error","filePath":"src/cmap/auth/mongodb_oidc/human_callback_workflow.ts","lineNumber":134,"sourceCode":"    const controller = new AbortController();\n    const params: OIDCCallbackParams = {\n      timeoutContext: controller.signal,\n      version: OIDC_VERSION,\n      idpInfo: idpInfo\n    };\n    if (credentials.username) {\n      params.username = credentials.username;\n    }\n    if (refreshToken) {\n      params.refreshToken = refreshToken;\n    }\n    const timeout = Timeout.expires(HUMAN_TIMEOUT_MS);\n    try {\n      return await Promise.race([this.executeAndValidateCallback(params), timeout]);\n    } catch (error) {\n      if (TimeoutError.is(error)) {\n        controller.abort();\n        throw new MongoOIDCError(`OIDC callback timed out after ${HUMAN_TIMEOUT_MS}ms.`);\n      }\n      throw error;\n    } finally {\n      timeout.clear();\n    }\n  }\n}\n","sourceCodeStart":116,"sourceCodeEnd":142,"githubUrl":"https://github.com/mongodb/node-mongodb-native/blob/3366c21a6311e02f1be91da982f9b93d3cce99a0/src/cmap/auth/mongodb_oidc/human_callback_workflow.ts#L116-L142","documentation":"Thrown by the human OIDC callback workflow when the OIDC callback does not return within HUMAN_TIMEOUT_MS (300000ms / 5 minutes) - see src/cmap/auth/mongodb_oidc/human_callback_workflow.ts:134 and callback_workflow.ts:18. The driver aborts the callback via the provided AbortSignal and surfaces this as a MongoOIDCError. The human workflow is used for interactive flows where a user logs in (e.g. browser-based device-code or auth-code login).","triggerScenarios":"Connecting with MONGODB-OIDC using a human/interactive callback that does not resolve within 5 minutes. Commonly the callback waits on user interaction (entering a code in a browser) that never completes, or performs a slow IdP HTTP request that ignores params.timeoutContext.","commonSituations":"User closes the browser without completing login, the IdP is unreachable, the callback prompts the user but the prompt is non-interactive (CI), or the callback performs a long synchronous operation.","solutions":["Ensure the end user completes the interactive login within 5 minutes.","Honor params.timeoutContext (AbortSignal) in the callback so the work is cancelled promptly on timeout.","For non-interactive contexts, use the automated/machine workflow (ENVIRONMENT) or a custom machine callback rather than a human callback.","Improve callback latency by pre-opening the browser or using device-code flows that return quickly."],"exampleFix":"// before: human callback blocks on user input with no signal handling\nconst humanCb = async (params) => {\n  const code = await waitForUserToEnterCode(); // blocks indefinitely\n  return exchangeCode(code);\n};\n\n// after: honor the abort signal\nconst humanCb = async (params) => {\n  const code = await waitForUserToEnterCode(params.timeoutContext);\n  if (params.timeoutContext.aborted) throw new Error('aborted');\n  return exchangeCode(code);\n};","handlingStrategy":"try-catch","validationCode":"function assertHumanCallbackHonorsSignal(cb: (p: any) => Promise<any>): Promise<void> {\n  const ac = new AbortController();\n  setTimeout(() => ac.abort(), 1000);\n  return cb({ timeoutContext: ac.signal, version: 1 }).then(\n    () => { /* ok */ },\n    e => { if (!/aborted/i.test(String(e))) throw new Error('Human callback ignored abort signal'); }\n  );\n}","typeGuard":null,"tryCatchPattern":"try {\n  await client.connect();\n} catch (e) {\n  if (e instanceof MongoOIDCError && /OIDC callback timed out/.test(e.message)) {\n    log.warn('Human OIDC login timed out; prompt user to complete within 5 minutes');\n  }\n  throw e;\n}","preventionTips":["Use the human workflow only in interactive contexts where a user is present.","Have the callback honor params.timeoutContext so user prompts cancel cleanly.","For CI/automated workloads, use the machine (automated) workflow instead."],"tags":["auth","oidc","timeout","interactive","callback"],"analyzedSha":"3366c21a6311e02f1be91da982f9b93d3cce99a0","analyzedAt":"2026-08-04T13:40:15.335Z","schemaVersion":2}