{"record":{"id":"d7c0e159ac7dacb4","repo":"Hmbown/CodeWhale","slug":"failed-to-download-skill-last-status","errorCode":null,"errorMessage":"failed to download skill (last status: {})","messagePattern":"failed to download skill \\(last status: (.+?)\\)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/skills/install.rs","lineNumber":1132,"sourceCode":"            DownloadAttempt::Bytes(bytes) => {\n                return Ok(DownloadOutcome::Bytes {\n                    bytes,\n                    url: url.clone(),\n                });\n            }\n            DownloadAttempt::NotFound(status) => {\n                last_status = Some(status);\n                continue;\n            }\n        }\n    }\n    if let Some(host) = denied_host {\n        return Ok(DownloadOutcome::Denied(host));\n    }\n    if let Some(host) = prompt_host {\n        return Ok(DownloadOutcome::NeedsApproval(host));\n    }\n    bail!(\n        \"failed to download skill (last status: {})\",\n        last_status\n            .map(|s| s.to_string())\n            .unwrap_or_else(|| \"unknown\".to_string())\n    );\n}\n\nenum DownloadAttempt {\n    Bytes(Vec<u8>),\n    NotFound(reqwest::StatusCode),\n}\n\n/// Stream a URL into memory with a size cap. Aborts on the first read that\n/// would push the buffer over `max_size * 4` (the *4 accounts for compression;\n/// the unpack step still enforces `max_size` on the *uncompressed* bytes).\nasync fn download_with_cap(url: &str, max_size: u64) -> Result<DownloadAttempt> {\n    let resp = reqwest_client()\n        .get(url)","sourceCodeStart":1114,"sourceCodeEnd":1150,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/skills/install.rs#L1114-L1150","documentation":"`download_first_success` tried all candidate URLs; every one either was denied/prompted (returned earlier) or failed with an HTTP error status. After the loop, if no bytes were obtained and no network-policy outcome applies, it bails reporting the last HTTP status seen, or `unknown` if no request ever completed.","triggerScenarios":"All candidate URLs (e.g. GitHub main-branch and master-branch tarballs, or registry-listed URLs) returned non-success, non-404 statuses — 500s, 403 rate limits, etc. — or no URL was even attempted.","commonSituations":"GitHub repo with a non-`main`/`master` default branch (both tarball URLs 404... note 404s are tracked as NotFound and folded into this final bail); private repo returning 403/404-ish statuses; server outage returning 5xx; corporate proxy blocking requests.","solutions":["Check the reported last HTTP status and hit the URL manually to diagnose","Verify the repo's default branch is `main` or `master`, or install via a direct tarball URL","Retry later if the server returned a 5xx; check auth/proxy if 403"],"exampleFix":"// before\ninstall(\"github:acme/skill\", &skills_dir, MAX, &network, false).await?; // 404/404 -> bail\n// after\nlet src = InstallSource::parse(\"https://git.example.com/acme/skill/archive/refs/heads/trunk.tar.gz\")?;\ninstall_with_registry(src, &skills_dir, MAX, &network, false, &registry_url).await?;","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match download_first_success(&urls, &network, MAX).await {\n    Err(e) if e.to_string().contains(\"failed to download skill\") => {\n        // inspect last status, retry transient 5xx with backoff\n        tokio::time::sleep(Duration::from_secs(2)).await;\n        retry_with_backoff(|| download_first_success(&urls, &network, MAX)).await?;\n    }\n    other => other?,\n}","preventionTips":["Pre-check URLs with curl/HEAD before scripting installs","Retry 5xx with exponential backoff","Ensure public reachability of candidate URLs (no private repos without tokens)"],"tags":["download","http","network"],"backgroundTag":"http-error-response","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}