{"record":{"id":"b22dd495a9203241","repo":"coleam00/Archon","slug":"failed-to-download-web-ui-tarballres-status","errorCode":null,"errorMessage":"Failed to download web UI: ${tarballRes.status} ${tarballRes.statusText}","messagePattern":"Failed to download web UI: (.+?) (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/serve.ts","lineNumber":162,"sourceCode":"      fetch(tarballUrl).catch((err: unknown) => {\n        throw new Error(\n          `Network error fetching tarball from ${tarballUrl}: ${toError(err).message}`\n        );\n      }),\n    ]);\n    if (!checksumsRes.ok) {\n      throw new Error(\n        `Failed to download checksums: ${checksumsRes.status} ${checksumsRes.statusText}`\n      );\n    }\n    const checksumsText = await checksumsRes.text();\n    expectedHash = parseChecksum(checksumsText, 'archon-web.tar.gz');\n    log.info({ source: 'remote' }, 'web_dist.checksum_resolved');\n    tarballRes = fetchedTarballRes;\n  }\n\n  if (!tarballRes.ok) {\n    throw new Error(`Failed to download web UI: ${tarballRes.status} ${tarballRes.statusText}`);\n  }\n  const tarballBuffer = await tarballRes.arrayBuffer();\n\n  // Verify checksum\n  const hasher = new Bun.CryptoHasher('sha256');\n  hasher.update(new Uint8Array(tarballBuffer));\n  const actualHash = hasher.digest('hex');\n\n  if (actualHash !== expectedHash) {\n    throw new Error(`Checksum mismatch: expected ${expectedHash}, got ${actualHash}`);\n  }\n  console.log('Checksum verified.');\n  const verifiedAt = performance.now();\n  log.info({ durationMs: Math.round(verifiedAt - downloadStartedAt) }, 'web_dist.tarball_verified');\n\n  // Extract to temp dir, then atomic rename\n  const tmpDir = `${targetDir}.tmp`;\n  const tarballPath = `${tmpDir}.tar.gz`;","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/serve.ts#L144-L180","documentation":"downloadWebDist fetches the archon-web.tar.gz release asset from a remote source and throws this when the HTTP response is not ok (tarballRes.ok is false). It surfaces the HTTP status code and status text so the operator can see whether the download endpoint rejected the request. It is an intentional fail-fast: serving a missing or corrupt web UI bundle is worse than refusing to start.","triggerScenarios":"serveCommand -> downloadWebDist performs a fetch of the web UI tarball; the response arrives but response.ok is false — e.g. 404 (release asset missing or version tag wrong), 403 (rate limited by the host or private repo), 5xx (server error), or a proxy returning an error page.","commonSituations":"Running a CLI version that references a release whose web tarball was not published or was deleted; GitHub rate limiting unauthenticated requests (403); corporate proxy returning 403/502; offline DNS-captive portal returning an HTML error page with a 4xx/5xx status; wrong download URL in configuration.","solutions":["Read the status in the message: retry after fixing the cause — 404 means the release asset is missing, so install/upgrade to a version whose release includes archon-web.tar.gz.","For 403/429, wait and retry or authenticate the download (e.g. set GITHUB_TOKEN if the fetch supports it); check rate-limit headers.","Verify network/proxy settings (HTTPS_PROXY etc.) and that the download host is reachable with curl.","As an alternative, build/serve the web UI locally instead of downloading it, if your install supports that path."],"exampleFix":"// before\nconst res = await fetch(tarballUrl); // no status handling, throws raw error at serve time\n// after\nconst res = await fetch(tarballUrl);\nif (!res.ok) {\n  if (res.status === 403 || res.status === 429) {\n    // back off and retry once with auth/rate-limit awareness\n  }\n  throw new Error(`Failed to download web UI: ${res.status} ${res.statusText}`);\n}","handlingStrategy":"try-catch","validationCode":"const probe = await fetch(tarballUrl, { method: 'HEAD' });\nif (!probe.ok) {\n  throw new Error(`web UI tarball unavailable: HTTP ${probe.status}; check release exists and rate limits`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await serveCommand();\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('Failed to download web UI:')) {\n    const status = Number(err.message.match(/: (\\d+)/)?.[1]);\n    if (status === 403 || status === 429) {\n      // wait/back off or supply auth, then retry\n    } else if (status === 404) {\n      // pin/upgrade CLI version whose release has the asset\n    }\n  } else throw err;\n}","preventionTips":["Pin the CLI to releases you have verified publish archon-web.tar.gz.","Configure download auth/credentials before hitting rate limits on large registries.","Pre-warm the download (or vendor the artifact locally) before running serve in CI or air-gapped environments.","Monitor the download host with a HEAD request in deploy scripts."],"tags":["network","download","http-status","cli"],"backgroundTag":"http-download-failed","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}