BigPizzaV3/CodexPlusPlus · error

下载 / 失败:HTTP

Error message

下载 {}/{} 失败:HTTP {}{}

What it means

download_repo_zip fetches the repo archive URL and bails on non-success status with the same HTTP-code-plus-hint pattern. Typical triggers are rate limiting (403/429) and nonexistent repo/branch (404); the hint text tells the user about GITHUB_TOKEN remedies.

Solutions

  1. 根据错误中的 HTTP 码定位:403 加 token/等待限流重置,404 核对 owner/name/ref,401 更换 token
  2. 确认仓库可见性,私库需配置有 repo 权限的 token
  3. 网络代理环境下检查代理是否拦截了 codeload.github.com
Defensive patterns

Strategy: retry

Validate before calling

let url = format!("https://codeload.github.com/{}/{}/zip/{}", repo.owner, repo.name, repo.branch);
if reqwest::Url::parse(&url).is_err() { eprintln!("仓库地址非法"); return; }

Try / catch

match download_repo_zip(&repo).await {
    Err(e) if e.to_string().contains("HTTP 404") => eprintln!("仓库或分支不存在,请核对 ref"),
    Err(e) if e.to_string().contains("HTTP 403") => eprintln!("限流或无权限,请配置 token"),
    Err(e) => eprintln!("下载失败:{e}"),
    Ok(bytes) => { /* 解压 */ }
}

Prevention

When it happens

Trigger: fetch 仓库 zip 下载接口返回 403 限流、404 仓库或 ref 不存在、401 token 无效、或 5xx 服务端错误。

Common situations: 匿名下载配额用尽;仓库为私有而 token 无权限;分支名拼写错误导致 codeload 404;GitHub 下载服务临时故障。

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/2f871e93e05db236. Report an issue: GitHub.

Appendix: source

Thrown at crates/codex-plus-core/src/skills.rs:968

        // 未认证请求每小时只有 60 次,四个仓库一起刷很容易撞上
        403 | 429 => {
            ":GitHub API 限流。设置 GITHUB_TOKEN 环境变量可把配额从每小时 60 次提到 5000 次"
        }
        404 => ":仓库或分支不存在(私有仓库需要设置 GITHUB_TOKEN)",
        _ => "",
    }
}

pub async fn download_repo_zip(repo: &SkillRepo) -> anyhow::Result<Vec<u8>> {
    let client = github_client()?;
    let response = with_github_auth(client.get(repo_zip_url(repo)))
        .header(reqwest::header::ACCEPT, "application/zip")
        .send()
        .await
        .with_context(|| format!("下载 {}/{} 失败", repo.owner, repo.name))?;
    let status = response.status();
    if !status.is_success() {
        anyhow::bail!(
            "下载 {}/{} 失败:HTTP {}{}",
            repo.owner,
            repo.name,
            status.as_u16(),
            github_status_hint(status.as_u16())
        );
    }
    let bytes = response.bytes().await.context("读取仓库压缩包内容失败")?;
    if bytes.len() > REPO_ZIP_DOWNLOAD_LIMIT_BYTES {
        anyhow::bail!("仓库压缩包太大:{} 字节", bytes.len());
    }
    Ok(bytes.to_vec())
}

/// 软链优先,失败回退复制。Windows 上建目录软链要开发者模式或管理员权限,
/// 拿不到就退化成复制——功能一样,只是更新时要重装。
fn link_or_copy(source: &Path, link: &Path) -> anyhow::Result<()> {
    if symlink_dir(source, link).is_ok() {

View on GitHub (pinned to b1ed92e5e4)