BigPizzaV3/CodexPlusPlus · error

仓库压缩包太大: 字节

Error message

仓库压缩包太大:{} 字节

What it means

After download_repo_zip reads the response bytes, it enforces a size ceiling (a few MB) and bails when the archive exceeds it. This prevents unbounded memory use when someone registers a huge repository as a skill source.

Solutions

  1. 改用更小/仅含技能目录的仓库或子目录打包
  2. 评估并按需调大 REPO_ZIP_DOWNLOAD_LIMIT_BYTES 常量
  3. 改为流式下载落盘再解压,避免一次性读入内存(代码改造)

Example fix

// before
if bytes.len() > REPO_ZIP_DOWNLOAD_LIMIT_BYTES {
    anyhow::bail!("仓库压缩包太大:{} 字节", bytes.len());
}
// after
if bytes.len() > REPO_ZIP_DOWNLOAD_LIMIT_BYTES {
    anyhow::bail!(
        "仓库压缩包太大:{} 字节(上限 {} 字节)",
        bytes.len(),
        REPO_ZIP_DOWNLOAD_LIMIT_BYTES
    );
}
Defensive patterns

Strategy: validation

Validate before calling

// 调用前用 HEAD 请求预检体积
let size: Option<u64> = client.head(&url).send().await.ok()
    .and_then(|r| r.headers().get(reqwest::header::CONTENT_LENGTH)?.to_str().ok()?.parse().ok());
if size.map(|s| s > REPO_ZIP_DOWNLOAD_LIMIT_BYTES).unwrap_or(false) {
    eprintln!("仓库 zip 预计超过大小上限,已跳过");
    return;
}

Try / catch

match download_repo_zip(&repo).await {
    Err(e) if e.to_string().contains("压缩包太大") => {
        eprintln!("仓库过大,请改用子目录打包或联系维护者调整上限");
    }
    other => other?,
}

Prevention

When it happens

Trigger: 目标仓库的 zip 包体积超过 REPO_ZIP_DOWNLOAD_LIMIT_BYTES(下载包含大量历史资产或大二进制文件的仓库时)。

Common situations: 误把含模型权重、视频或数据集的大仓库当作技能仓库安装;上游仓库膨胀后首次超过阈值;limits 常量配置过小。

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


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

Appendix: source

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

    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() {
        return Ok(());
    }
    copy_dir_all(source, link)
        .with_context(|| format!("复制 skill 到 {} 失败(软链也没建成)", link.display()))
}

#[cfg(unix)]
fn symlink_dir(source: &Path, link: &Path) -> std::io::Result<()> {
    std::os::unix::fs::symlink(source, link)
}

View on GitHub (pinned to b1ed92e5e4)