{"record":{"id":"81e10c668419123d","repo":"stablyai/orca","slug":"refusing-to-replace-non-orca-command-at-status-c-81e10c","errorCode":null,"errorMessage":"Refusing to replace non-Orca command at ${status.commandPath}.","messagePattern":"Refusing to replace non-Orca command at (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/cli/wsl-cli-installer.ts","lineNumber":208,"sourceCode":"      // Why: adopting the legacy command would fail install()'s bridge guard\n      // forever; stay registered so reconciliation retries after an update.\n      return { changed: false, managed: true, status }\n    }\n\n    // Why: a legacy-only managed command proves the user opted into WSL CLI\n    // registration; install the current name before removing that owned script.\n    return { changed: true, managed: true, status: await this.install(status) }\n  }\n\n  async install(precomputedStatus?: CliInstallStatus): Promise<CliInstallStatus> {\n    // Why: repair passes its fresh probe; re-probing here would double every\n    // WSL round trip on the startup reconciliation path.\n    const status = precomputedStatus ?? (await this.getStatus())\n    if (!status.supported || !status.commandPath || !status.launcherPath) {\n      throw new Error(status.detail ?? 'WSL CLI registration is unavailable.')\n    }\n    if (status.state === 'conflict') {\n      throw new Error(`Refusing to replace non-Orca command at ${status.commandPath}.`)\n    }\n\n    // Why: the launcher and PowerShell bridge are one registration; the\n    // command replacement stays a single atomic rename (never missing for a\n    // concurrent shell) while a bridge copy enables rollback of the pair.\n    await this.run(\n      this.distro as string,\n      [\n        'set -euo pipefail',\n        `mkdir -p ${quoteShell(status.pathDirectory as string)}`,\n        `mkdir -p ${quoteShell(getPosixDirname(getBridgePathFromCommandPath(status.commandPath)))}`,\n        buildRegistrationLockPrelude(status.commandPath),\n        `command_tmp=${quoteShell(`${status.commandPath}.tmp`)}.$$`,\n        `bridge_path=${quoteShell(getBridgePathFromCommandPath(status.commandPath))}`,\n        `legacy_command_path=${quoteShell(\n          `${getPosixDirname(status.commandPath)}/${LEGACY_WSL_COMMAND_NAME}`\n        )}`,\n        'bridge_tmp=\"${bridge_path}.tmp.$$\"',","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/cli/wsl-cli-installer.ts#L190-L226","documentation":"Thrown by WslCliInstaller.install() when status.state is 'conflict' — a non-Orca command exists at the target commandPath inside the WSL distro. The WSL equivalent of the host installer's conflict guard.","triggerScenarios":"Calling install() when another command (not Orca-managed) exists at the target path inside the WSL distro. The buildSafeReplaceGuard check in the bash install script detects the foreign command.","commonSituations":"A different 'orca' binary was installed in the WSL distro's bin directory. A legacy Orca command without the managed marker. Another package manager (apt, brew in WSL) installed a conflicting binary.","solutions":["Inside WSL, check the conflicting file: 'wsl -d <distro> -- cat <commandPath>' and look for Orca markers.","If safe, remove the conflicting file inside WSL and retry.","If it's a tool you need, install Orca CLI under a different name or path."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const status = await wslInstaller.getStatus()\nif (status.state === 'conflict') {\n  showConflictGuidance(status.commandPath)\n  return\n}","typeGuard":null,"tryCatchPattern":"try {\n  await wslInstaller.install()\n} catch (error) {\n  if (error instanceof Error && error.message.includes('Refusing to replace non-Orca command')) {\n    // Prompt user to remove conflicting file inside WSL\n  } else { throw error }\n}","preventionTips":["Check for existing commands at the target path inside WSL before installing.","Document that Orca checks managed markers before overwriting."],"tags":["cli-installer","wsl","installation","conflict","safety-guard"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}