{"record":{"id":"488dd9198d20dc43","repo":"ruvnet/ruflo","slug":"gh-release-download-failed-exit-result-exitcode","errorCode":null,"errorMessage":"gh release download failed (exit ${result.exitCode}): ${result.stderr || result.stdout}","messagePattern":"gh release download failed \\(exit (.+?)\\): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/proxy/release.ts","lineNumber":121,"sourceCode":"  const exec = await ghExecutor();\n  const result = await exec.execute('gh', [\n    'release',\n    'download',\n    `v${version}`,\n    '--repo',\n    GH_REPO,\n    '--dir',\n    destDir,\n    '--pattern',\n    archiveFilename,\n    '--pattern',\n    'SHA256SUMS',\n    '--pattern',\n    'SHA256SUMS.sig',\n    '--clobber',\n  ]);\n  if (result.exitCode !== 0) {\n    throw new Error(`gh release download failed (exit ${result.exitCode}): ${result.stderr || result.stdout}`);\n  }\n\n  const { readFile } = await import('node:fs/promises');\n  const { join } = await import('node:path');\n  const [archiveBytes, sumsBytes, sigRaw] = await Promise.all([\n    readFile(join(destDir, archiveFilename)),\n    readFile(join(destDir, 'SHA256SUMS')),\n    readFile(join(destDir, 'SHA256SUMS.sig'), 'utf-8'),\n  ]);\n  return { archiveBytes, archiveFilename, sumsBytes, sigBase64: sigRaw.trim() };\n}\n\n/**\n * Production download path — a Cognitum-owned, auth-mediated release-proxy\n * endpoint. Not implemented: no such endpoint exists in the confirmed\n * OpenAPI contract today. Throws a clear, specific error rather than\n * silently falling back to the dev path, so a real user hitting this isn't\n * left guessing whether it's their environment or a genuine gap.","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/proxy/release.ts#L103-L139","documentation":"The dev/internal download path (enabled via RUFLO_DEV_PROXY_INSTALL / release-source override) shells out to `gh release download -R cognitum-one/meta-proxy` through SafeExecutor; a non-zero exit code is surfaced verbatim with gh's stderr or stdout. The embedded text is gh's own output, which distinguishes auth, not-found, and network causes.","triggerScenarios":"gh CLI not installed (command-not-found exit code); gh present but never authenticated (`gh auth login` not run) against the repo; the release tag or the requested --pattern assets not found; network failure inside gh.","commonSituations":"Developers enabling RUFLO_DEV_PROXY_INSTALL on machines without gh; CI containers missing the gh binary; expired gh tokens; requesting an asset pattern for a triple the release does not contain.","solutions":["Read the embedded gh stderr — it names the exact cause (auth vs not-found vs network)","Install gh and authenticate: `gh auth login`, verify with `gh auth status`","Test access directly: `gh release view -R cognitum-one/meta-proxy` and check the asset list matches the requested patterns","Unset RUFLO_DEV_PROXY_INSTALL to fall back to the default public-dist download path, which needs no gh"],"exampleFix":"# before\nRUFLO_DEV_PROXY_INSTALL=1 ruflo proxy install   # gh release download failed (exit 1)\n# after\ngh auth login && gh release view -R cognitum-one/meta-proxy && \\\n  RUFLO_DEV_PROXY_INSTALL=1 ruflo proxy install","handlingStrategy":"validation","validationCode":"import { spawnSync } from 'node:child_process';\nconst ghOk = spawnSync('gh', ['auth', 'status'], { encoding: 'utf8' }).status === 0;\nif (process.env.RUFLO_DEV_PROXY_INSTALL && !ghOk) {\n  throw new Error('dev install needs an authenticated gh CLI (run `gh auth login`)');\n}","typeGuard":"const isGhDownloadFailure = (e: unknown): e is Error =>\n  e instanceof Error && /^gh release download failed \\(exit \\d+\\)/.test(e.message);","tryCatchPattern":"try {\n  await installProxy({ version });\n} catch (e) {\n  if (isGhDownloadFailure(e)) {\n    console.error(e.message); // gh's own stderr names the cause\n    delete process.env.RUFLO_DEV_PROXY_INSTALL; // optionally fall back to the public-dist path\n    return installProxy({ version });\n  }\n  throw e;\n}","preventionTips":["Run `gh auth status` before enabling dev install","Install gh in CI images that use RUFLO_DEV_PROXY_INSTALL","Verify asset patterns exist: `gh release view -R cognitum-one/meta-proxy --json assets`"],"tags":["gh-cli","download","authentication","dev-install","subprocess"],"backgroundTag":"gh-cli-failed","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}