BigPizzaV3/CodexPlusPlus · error

下载内容超过 {} 字节限制

Error message

下载内容超过 {} 字节限制

What it means

Size-limit guard in download_limited: either the HTTP Content-Length header or the accumulated streamed bytes exceed the per-asset limit (manifest/theme/image each have their own cap). Prevents a malicious or misconfigured market server from exhausting memory or disk.

Source

Thrown at crates/codex-plus-core/src/dream_skin_market.rs:267

}

async fn download_limited(
    client: &reqwest::Client,
    url: &str,
    limit: usize,
) -> anyhow::Result<Vec<u8>> {
    let response = client
        .get(url)
        .send()
        .await
        .with_context(|| format!("请求失败:{url}"))?
        .error_for_status()
        .with_context(|| format!("服务器返回错误状态:{url}"))?;
    if response
        .content_length()
        .is_some_and(|size| size > limit as u64)
    {
        bail!("下载内容超过 {} 字节限制", limit);
    }
    let mut stream = response.bytes_stream();
    let mut bytes = Vec::new();
    while let Some(chunk) = stream.next().await {
        let chunk = chunk.context("读取下载内容失败")?;
        if bytes.len().saturating_add(chunk.len()) > limit {
            bail!("下载内容超过 {} 字节限制", limit);
        }
        bytes.extend_from_slice(&chunk);
    }
    if bytes.is_empty() {
        bail!("下载内容为空");
    }
    Ok(bytes)
}

fn cache_manifest(state_dir: &Path, manifest: &DreamSkinMarketManifest) -> anyhow::Result<()> {
    let bytes = serde_json::to_vec_pretty(manifest)?;

View on GitHub (pinned to f2074595a2)

Solutions

  1. Retry after the market asset is fixed/reduced
  2. Check whether the asset URL is serving the wrong (oversized) content
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/codex-plus-core/src/dream_skin_market.rs:267 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@f2074595a2 (2026-08-23). Data as JSON: /api/errors/acd1c4a51cc6b8a5. Report an issue: GitHub.