{"record":{"id":"a7e788c1a1a343a4","repo":"CherryHQ/cherry-studio","slug":"user-denied-the-feishu-app-registration","errorCode":null,"errorMessage":"User denied the Feishu app registration","messagePattern":"User denied the Feishu app registration","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/main/ai/channels/adapters/feishu/FeishuAppRegistration.ts","lineNumber":126,"sourceCode":"      const userInfo = res.user_info as Record<string, string> | undefined\n      logger.info('Feishu app registration succeeded')\n      return {\n        appId: res.client_id as string,\n        appSecret: res.client_secret as string,\n        openId: userInfo?.open_id\n      }\n    }\n\n    // Handle error states\n    const error = (res.error as string) ?? ''\n    switch (error as PollStatus) {\n      case 'authorization_pending':\n        continue\n      case 'slow_down':\n        interval += 5000\n        continue\n      case 'access_denied':\n        throw new Error('User denied the Feishu app registration')\n      case 'expired_token':\n        throw new Error('Feishu app registration QR code expired')\n      default:\n        if (error) {\n          throw new Error(`Feishu registration poll error: ${error}`)\n        }\n        continue\n    }\n  }\n\n  throw new Error('Feishu app registration timed out')\n}\n","sourceCodeStart":108,"sourceCodeEnd":139,"githubUrl":"https://github.com/CherryHQ/cherry-studio/blob/726446b54cd69ffe51a276638672f6d95ca0768c/src/main/ai/channels/adapters/feishu/FeishuAppRegistration.ts#L108-L139","documentation":"Thrown by registrationPoll() when the poll response carries error='access_denied'. This is the OAuth/device-flow standard error meaning the end user actively rejected the consent/QR authorization in Feishu.","triggerScenarios":"User scans the QR in Feishu then taps 'deny'/'cancel' on the consent screen; the next poll returns {error:'access_denied'} and the switch throws.","commonSituations":"User changed their mind, selected the wrong account, or the consent screen warned about scopes they declined.","solutions":["Surface a clear 'authorization denied by user' message and offer to restart the flow.","Do not auto-retry — retrying immediately will just re-prompt; let the user re-initiate.","Pre-explain required scopes on the QR screen so users don't deny."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// No pre-call validation: access_denied is a user runtime decision.\n// Defense is to handle it gracefully post-event.","typeGuard":"function isFeishuUserDenied(e: unknown): e is Error {\n  return e instanceof Error && e.message === 'User denied the Feishu app registration'\n}","tryCatchPattern":"try {\n  await registrationPoll(domain, deviceCode, opts)\n} catch (e) {\n  if (isFeishuUserDenied(e)) { notifyUser('You denied the Feishu authorization. Restart to try again.'); return }\n  throw e\n}","preventionTips":["Pre-explain required scopes on the QR screen to reduce denials.","Do not auto-retry immediately after a denial; let the user re-initiate.","Treat access_denied as terminal for this device_code, not transient."],"tags":["feishu","registration","oauth","user-denied","consent"],"backgroundTag":null,"analyzedSha":"726446b54cd69ffe51a276638672f6d95ca0768c","analyzedAt":"2026-08-12T17:30:37.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}