{"record":{"id":"66256f27fe61e514","repo":"stablyai/orca","slug":"could-not-create-a-temporary-wsl-claude-login-dire","errorCode":null,"errorMessage":"Could not create a temporary WSL Claude login directory.","messagePattern":"Could not create a temporary WSL Claude login directory\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/claude-accounts/service.ts","lineNumber":676,"sourceCode":"    if (!location.wslDistro) {\n      throw new Error('Could not resolve the active WSL distribution for Claude login.')\n    }\n    const linuxPath = execFileSync(\n      'wsl.exe',\n      [\n        '-d',\n        location.wslDistro,\n        '--',\n        'bash',\n        '-lc',\n        'mktemp -d \"${TMPDIR:-/tmp}/orca-claude-login.XXXXXX\"'\n      ],\n      { encoding: 'utf-8', timeout: 5000 }\n    )\n      .replaceAll(String.fromCharCode(0), '')\n      .trim()\n    if (!linuxPath.startsWith('/')) {\n      throw new Error('Could not create a temporary WSL Claude login directory.')\n    }\n    return {\n      windowsPath: toWindowsWslPath(linuxPath, location.wslDistro),\n      linuxPath,\n      wslDistro: location.wslDistro\n    }\n  }\n\n  private removeTemporaryClaudeConfigDir(tempConfig: {\n    windowsPath: string\n    linuxPath: string | null\n    wslDistro: string | null\n  }): void {\n    if (tempConfig.linuxPath && tempConfig.wslDistro) {\n      try {\n        execFileSync(\n          'wsl.exe',\n          [","sourceCodeStart":658,"sourceCodeEnd":694,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/claude-accounts/service.ts#L658-L694","documentation":"Thrown by createTemporaryClaudeConfigDir() when the WSL `mktemp -d` invocation returned a path that does not start with '/' (after stripping NULs and trimming). This means mktemp output was malformed or empty — the temp directory for the login was not actually created inside the distro, so the subsequent path translation would be invalid.","triggerScenarios":"wsl.exe ran but mktemp produced no output, an error message instead of a path, or output that got mangled by encoding (CRLF, NUL, locale). The 5s timeout on execFileSync was hit and returned partial/empty stdout. The distro's TMPDIR is unset and /tmp is not writable.","commonSituations":"WSL distro misconfiguration (no /tmp, read-only). mktemp binary missing or broken in the distro. Locale/encoding corruption of wsl.exe stdout. The 5000ms timeout fired on a slow distro startup.","solutions":["Verify the WSL distro boots and `wsl -d <distro> -- bash -lc 'mktemp -d'` returns a valid /tmp path manually.","Increase the 5000ms execFileSync timeout if the distro is slow to start.","Ensure TMPDIR and /tmp are writable inside the distro.","If wsl.exe returns CRLF or other encoding artifacts, normalize before validating (the code already strips NULs)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  return createTemporaryClaudeConfigDir(location)\n} catch (error) {\n  if (error instanceof Error && /Could not create a temporary WSL/.test(error.message)) {\n    // verify distro health: wsl -d <distro> -- bash -lc 'mktemp -d'\n  }\n  throw error\n}","preventionTips":["Verify the distro boots and mktemp works before login.","Increase the 5s execFileSync timeout for slow distros.","Ensure TMPDIR and /tmp are writable in the distro.","Normalize wsl.exe stdout encoding (strip CRLF/NUL) before validating."],"tags":["claude-accounts","wsl","windows","mktemp","filesystem"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}