{"record":{"id":"fa8e47961e4e1c9a","repo":"stablyai/orca","slug":"refusing-to-remove-a-command-not-owned-by-orca-at","errorCode":null,"errorMessage":"Refusing to remove a command not owned by Orca at ${status.commandPath}.","messagePattern":"Refusing to remove a command not owned by Orca at (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/main/cli/cli-installer.ts","lineNumber":232,"sourceCode":"\n  async remove(): Promise<CliInstallStatus> {\n    const status = await this.getStatus()\n    if (!status.supported || !status.commandPath || !status.launcherPath || !status.installMethod) {\n      return status\n    }\n    if (status.state === 'not_installed') {\n      await this.removeLegacyLinuxCommandIfManaged(status.launcherPath)\n      if (this.platform === 'win32') {\n        await this.removeWindowsPathEntry(dirname(status.commandPath))\n        return this.getStatus()\n      }\n      return status\n    }\n    if (status.state === 'conflict') {\n      throw new Error(`Refusing to remove non-Orca command at ${status.commandPath}.`)\n    }\n    if (status.state === 'stale') {\n      throw new Error(`Refusing to remove a command not owned by Orca at ${status.commandPath}.`)\n    }\n\n    if (status.installMethod === 'symlink') {\n      await this.removeSymlink(status.commandPath)\n      await this.removeLegacyLinuxCommandIfManaged(status.launcherPath)\n    } else if (this.isWindowsPackagedBundledCommand(status.commandPath, status.launcherPath)) {\n      await this.removeWindowsPathEntry(dirname(status.commandPath))\n    } else {\n      await unlink(status.commandPath)\n      await this.removeWindowsPathEntry(dirname(status.commandPath))\n    }\n\n    return this.getStatus()\n  }\n\n  private resolveInstallSpec(): InstallSpec | null {\n    const commandPath = this.resolveCommandPath()\n    if (!commandPath) {","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/cli/cli-installer.ts#L214-L250","documentation":"Thrown by CliInstaller.remove() when status.state is 'stale'. A stale command is one that exists at the path but is neither a clean Orca-managed command nor a clear foreign conflict — it may be a partially-installed or leftover Orca command that no longer passes ownership verification.","triggerScenarios":"Calling remove() when the status probe classifies the command as 'stale'. This happens when the file exists but its marker is missing or corrupted, or it's a broken symlink pointing to a deleted Orca binary.","commonSituations":"A previous Orca version was uninstalled but left a wrapper script. The Orca binary was moved/deleted but the symlink or wrapper remains. The managed marker was stripped by a system cleanup tool.","solutions":["Inspect the file at status.commandPath: 'ls -la' and 'cat' it to check for Orca markers.","If it's a broken symlink or leftover Orca wrapper, manually remove it and retry.","Reinstall Orca CLI (install()) to reset the marker, then remove() cleanly."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const status = await installer.getStatus()\nif (status.state === 'stale') {\n  // Investigate before calling remove()\n  showStaleGuidance(status.commandPath)\n  return\n}","typeGuard":null,"tryCatchPattern":"try {\n  await installer.remove()\n} catch (error) {\n  if (error instanceof Error && error.message.includes('not owned by Orca')) {\n    // Attempt reinstall first to reset markers, then remove\n  } else { throw error }\n}","preventionTips":["Use install() to reset markers on a stale command before remove().","Avoid partial manual deletions of Orca CLI files."],"tags":["cli-installer","removal","stale-state","safety-guard"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}