{"record":{"id":"4a8362dab50bd257","repo":"stablyai/orca","slug":"no-claude-credentials-found-in-resolveddir-run","errorCode":null,"errorMessage":"No Claude credentials found in ${resolvedDir}. Run `claude login` into this directory first.","messagePattern":"No Claude credentials found in (.+?)\\. Run `claude login` into this directory first\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/main/claude-accounts/service.ts","lineNumber":218,"sourceCode":"\n  // Why: capture credentials from a CLAUDE_CONFIG_DIR the caller already\n  // authenticated (e.g. a temp dir the CLI ran `claude login` into), mirroring\n  // runClaudeLoginAndCapture's capture step but without spawning the interactive\n  // login. On Linux/Windows the credentials live in a plaintext `.credentials.json`.\n  private async captureFromExistingConfigDir(\n    configDir: string,\n    previousLegacyCredentialsSha256?: string | null\n  ): Promise<CapturedClaudeAuth> {\n    const trimmed = configDir.trim()\n    if (!trimmed) {\n      throw new Error('A Claude config directory path is required.')\n    }\n    const resolvedDir = resolve(trimmed)\n    // Why: macOS keeps Claude credentials in the Keychain rather than a file, so\n    // only require `.credentials.json` off-darwin; captureAuthFromConfigDir reads\n    // the scoped Keychain item on macOS.\n    if (process.platform !== 'darwin' && !existsSync(join(resolvedDir, '.credentials.json'))) {\n      throw new Error(\n        `No Claude credentials found in ${resolvedDir}. Run \\`claude login\\` into this directory first.`\n      )\n    }\n    // Why: `allowFailure` covers a non-zero exit but not a spawn error, and unlike\n    // the GUI flow nothing has run `claude` in this process yet — a daemon started\n    // with a minimal PATH (launchd/systemd) would hard-fail an add the user already\n    // signed in for. Identity still resolves from the config dir's oauthAccount.\n    let status = ''\n    try {\n      status = await this.runClaudeCommand(\n        ['auth', 'status', '--json'],\n        { windowsPath: resolvedDir, linuxPath: null, wslDistro: null },\n        STATUS_TIMEOUT_MS,\n        { allowFailure: true }\n      )\n    } catch (error) {\n      console.warn('[claude-accounts] Could not read `claude auth status`:', error)\n    }","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/claude-accounts/service.ts#L200-L236","documentation":"Thrown by captureFromExistingConfigDir() on non-macOS platforms when the resolved configDir does not contain a .credentials.json file. On Linux/Windows Claude stores OAuth credentials as plaintext .credentials.json, so its absence means the directory was never authenticated via `claude login`. macOS is exempt because credentials live in the Keychain.","triggerScenarios":"On Linux/Windows, calling captureFromExistingConfigDir with a dir where `claude login` was never run, or pointing at the wrong directory. The .credentials.json file was deleted or never created.","commonSituations":"User selects a fresh/empty temp dir instead of the one they logged into. Path points at the parent of the actual config dir. The CLI wrote credentials to a different CLAUDE_CONFIG_DIR than the one supplied. The login failed silently and left no credentials.","solutions":["Run `claude login` with CLAUDE_CONFIG_DIR set to the exact directory you pass to captureFromExistingConfigDir.","Verify fs.existsSync(join(dir, '.credentials.json')) before calling.","Confirm the directory path is the one the CLI actually used (check for .claude.json / .config.json siblings).","On macOS, remember credentials live in the Keychain, not the file — do not require .credentials.json there."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { existsSync, join } from 'node:path'\n\nif (process.platform !== 'darwin' && !existsSync(join(resolvedDir, '.credentials.json'))) {\n  throw new Error(`No credentials in ${resolvedDir}. Run 'claude login' there first.`)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `claude login` with CLAUDE_CONFIG_DIR pointing at the exact dir before importing.","Verify .credentials.json exists (off-darwin) before capture.","Remember macOS stores credentials in the Keychain, not the file.","Use the same dir for login and capture."],"tags":["claude-accounts","credentials","filesystem","platform","validation"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}