{"record":{"id":"7bcae8e663cc1fb0","repo":"ruvnet/ruflo","slug":"expand-archive-failed-exit-result-exitcode","errorCode":null,"errorMessage":"Expand-Archive failed (exit ${result.exitCode}): ${result.stderr || result.stdout}","messagePattern":"Expand-Archive failed \\(exit (.+?)\\): (.+?)","errorType":"exception","errorClass":"ExtractionError","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/proxy/install.ts","lineNumber":53,"sourceCode":"  if (result.exitCode !== 0) {\n    throw new ExtractionError(`tar extraction failed (exit ${result.exitCode}): ${result.stderr || result.stdout}`);\n  }\n}\n\n/**\n * Single-quoted literal paths (doubling any embedded single quote per\n * PowerShell string-literal escaping) passed as ONE argv element to\n * `-Command`. shell:false means no OS shell ever tokenizes this string —\n * only powershell.exe's own parser does.\n */\nasync function extractWithPowerShell(archivePath: string, extractDir: string): Promise<void> {\n  const { SafeExecutor } = await import('@claude-flow/security');\n  const escape = (p: string) => p.replace(/'/g, \"''\");\n  const command = `Expand-Archive -LiteralPath '${escape(archivePath)}' -DestinationPath '${escape(extractDir)}' -Force`;\n  const exec = new SafeExecutor({ allowedCommands: ['powershell', 'powershell.exe'], timeout: 60_000 });\n  const result = await exec.execute('powershell', ['-NoProfile', '-NonInteractive', '-Command', command]);\n  if (result.exitCode !== 0) {\n    throw new ExtractionError(`Expand-Archive failed (exit ${result.exitCode}): ${result.stderr || result.stdout}`);\n  }\n}\n\n/**\n * Extracts the archive via the OS's own tools — `tar` for `.tar.gz`\n * (present on macOS/Linux/Windows 10+), PowerShell `Expand-Archive`\n * specifically for `.zip` on Windows. Zero new archive-parsing dependency,\n * matching this repo's existing taste for shelling out over adding a parser dep.\n *\n * `Expand-Archive` stays the PRIMARY `.zip` path — bsdtar's zip support is\n * still not something to lean on by default. But `Microsoft.PowerShell.Archive`\n * is a *script* module resolved through PowerShell's module autoloading, so it\n * can fail for environment reasons entirely unrelated to the archive. Observed\n * in the wild on a healthy Windows 11 box, from ruflo's own `-NonInteractive`\n * child process:\n *\n *   Expand-Archive : The 'Expand-Archive' command was found in the module\n *   'Microsoft.PowerShell.Archive', but the module could not be loaded.","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/ruvnet/ruflo/blob/6b01dc5a687b26b3e218f796de45ec51f8fa9e8c/v3/@claude-flow/cli/src/proxy/install.ts#L35-L71","documentation":"Error \"Expand-Archive failed (exit ${result.exitCode}): ${result.stderr || result.stdout}\" thrown in ruvnet/ruflo.","triggerScenarios":"Thrown at v3/@claude-flow/cli/src/proxy/install.ts:53 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":"6b01dc5a687b26b3e218f796de45ec51f8fa9e8c","analyzedAt":"2026-08-12T13:20:50.148Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}