{"record":{"id":"8414308459b34122","repo":"diegosouzapw/OmniRoute","slug":"download-failed-res-status","errorCode":null,"errorMessage":"Download failed: ${res.status}","messagePattern":"Download failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/versionManager/binaryManager.ts","lineNumber":45,"sourceCode":"  const a = os.arch();\n  if (a === \"x64\") return \"amd64\";\n  if (a === \"arm64\") return \"arm64\";\n  return \"amd64\";\n}\n\nexport function getAssetName(platform?: Platform, arch?: Arch): string {\n  const plat = platform || detectPlatform();\n  const arc = arch || detectArch();\n  return `CLIProxyAPI_{version}_${plat}_${arc}${plat === \"windows\" ? \".zip\" : \".tar.gz\"}`;\n}\n\nexport function getTargetPlatform(): { platform: Platform; arch: Arch } {\n  return { platform: detectPlatform(), arch: detectArch() };\n}\n\nasync function downloadFile(url: string, dest: string, signal?: AbortSignal): Promise<void> {\n  const res = await fetch(url, { signal });\n  if (!res.ok || !res.body) throw new Error(`Download failed: ${res.status}`);\n  const fileStream = fsSync.createWriteStream(dest);\n  await pipeline(res.body as unknown as NodeJS.ReadableStream, fileStream);\n}\n\nasync function extractTarGz(archivePath: string, destDir: string): Promise<void> {\n  await execFileAsync(\"tar\", [\"xzf\", archivePath, \"-C\", destDir]);\n}\n\n/**\n * #5590: Windows has no `unzip` on the system PATH — it only ships inside Git for\n * Windows' `usr/bin`, which Node's `spawn` PATH never sees, so `execFile(\"unzip\")`\n * fails with `spawn unzip ENOENT`. Use PowerShell's built-in `Expand-Archive`\n * there (present on every supported Windows; this is the install path for the\n * Node-24-only embedded services). `execFileAsync` uses no shell, so the paths are\n * a single argument and are not shell-interpreted; the `''` escaping covers the\n * PowerShell `-Command` string and `-LiteralPath` prevents wildcard expansion.\n */\nexport function buildExtractZipCommand(","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/versionManager/binaryManager.ts#L27-L63","documentation":"Error \"Download failed: ${res.status}\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/versionManager/binaryManager.ts:45 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}