{"record":{"id":"2cb58402c99e3128","repo":"stablyai/orca","slug":"claude-login-completed-but-orca-could-not-resolve","errorCode":null,"errorMessage":"Claude login completed, but Orca could not resolve the account email.","messagePattern":"Claude login completed, but Orca could not resolve the account email\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/claude-accounts/service.ts","lineNumber":255,"sourceCode":"    // Why: this post-login RPC did not observe the legacy Keychain value before\n    // login unless the CLI supplied its one-way pre-login credential baseline.\n    const currentLegacyKeychain = await readActiveClaudeKeychainCredentialsStrict()\n    return this.captureAuthFromConfigDir(\n      resolvedDir,\n      status,\n      currentLegacyKeychain,\n      previousLegacyCredentialsSha256\n    )\n  }\n\n  private async persistCapturedClaudeAccount(\n    accountId: string,\n    managedAuth: ManagedClaudeAuthLocation,\n    previousSettings: ReturnType<Store['getSettings']>,\n    captured: CapturedClaudeAuth\n  ): Promise<ClaudeRateLimitAccountsState> {\n    if (!captured.identity.email) {\n      throw new Error('Claude login completed, but Orca could not resolve the account email.')\n    }\n    // Why: duplicate rows confuse selection and rate-limit tracking; re-authentication\n    // is the supported way to refresh an account that is already managed.\n    if (\n      findDuplicateClaudeAccount(previousSettings.claudeManagedAccounts, {\n        email: captured.identity.email,\n        organizationUuid: captured.identity.organizationUuid,\n        managedAuthRuntime: managedAuth.managedAuthRuntime,\n        wslDistro: managedAuth.wslDistro\n      })\n    ) {\n      throw new DuplicateClaudeAccountError('This Claude account is already added.')\n    }\n    await this.writeManagedAuth(accountId, managedAuth.managedAuthPath, captured)\n\n    const now = Date.now()\n    const account: ClaudeManagedAccount = {\n      id: accountId,","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/claude-accounts/service.ts#L237-L273","documentation":"Thrown by persistCapturedClaudeAccount() when captured.identity.email is falsy after a login+capture flow. The login technically completed (credentials were read) but the account email could not be resolved from any of: `claude auth status --json`, oauth-account.json, or the credentials JSON's claudeAiOauth.email. Orca refuses to persist an account without a primary identifier.","triggerScenarios":"The Claude CLI version emits a different status JSON shape Orca cannot parse. oauth-account.json and .credentials.json lack an email field. `claude auth status` failed/warned and returned no usable identity. A newer/older CLI schema mismatch.","commonSituations":"Claude CLI version skew (Orca's parser expects fields the installed CLI does not emit). A partial login that produced credentials but no identity record. Enterprise SSO accounts where the email is in a non-standard field.","solutions":["Update the Claude CLI to a version Orca supports and re-authenticate.","Inspect the temp config dir's .claude.json / .credentials.json / oauth-account.json for an email field and report the schema.","Re-run `claude login` fully (not from existing dir) so the CLI populates identity.","If the email lives in a new field, extend resolveIdentity to read it."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await persistCapturedClaudeAccount(...)\n} catch (error) {\n  if (error instanceof Error && /could not resolve the account email/.test(error.message)) {\n    // surface 'update Claude CLI and re-auth' to the user\n  }\n  throw error\n}","preventionTips":["Keep the Claude CLI at a version Orca supports.","Inspect the captured identity JSON shape after CLI updates.","Extend resolveIdentity when the CLI adds new email fields.","Validate identity.email is present before persisting."],"tags":["claude-accounts","identity","oauth","cli","schema"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}