BigPizzaV3/CodexPlusPlus · error

超过大小限制

Error message

{label}超过大小限制

What it means

read_response_limited streams the HTTP response body and enforces a byte cap (max_bytes); if accumulated bytes would exceed the cap it bails with '{label}超过大小限制'. This protects against unbounded/downsized-response attacks or unexpectedly huge payloads from the WeChat endpoints.

Solutions

  1. Verify the endpoint URL is the genuine WeChat API; a non-WeChat server may return oversized bodies.
  2. Check intermediaries (proxies, captive portals) that inject large HTML into responses.
  3. If a legitimate larger payload is required, raise the corresponding MAX_*_BYTES constant in weixin.rs and rebuild.
  4. Inspect what the server actually returns with curl to confirm body size and content type.
Defensive patterns

Strategy: fallback

Validate before calling

// before calling, verify the endpoint is the real API
let resp = client.get(api_base).send().await?;
let ct = resp.headers().get("content-type").and_then(|v| v.to_str().ok());
anyhow::ensure!(ct.map_or(false, |c| c.contains("json")), "endpoint not returning JSON");

Try / catch

// Rust
match connector.fetch_qr_code().await {
    Err(e) if e.to_string().contains("超过大小限制") => {
        // treat as endpoint misconfig/interference: log URL, switch or disable connector
        Err(anyhow!("WeChat endpoint returned oversized body; check proxy/URL"))
    }
    other => other,
}

Prevention

When it happens

Trigger: Any caller (fetch_qr_code, poll_qr_status, get_updates, send_text) receiving a response whose streamed body exceeds the per-call MAX_*_BYTES limit while chunks are accumulated in read_response_limited.

Common situations: A compromised or misbehaving proxy returning a huge body, a misconfigured endpoint that is not actually the WeChat API (e.g. a large HTML error page served as 200), or QR/status payloads inflated by an intermediary.

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/43baa2182c21b1a7. Report an issue: GitHub.

Appendix: source

Thrown at crates/codex-plus-core/src/connect/weixin.rs:370

        .render::<qrcode::render::svg::Color>()
        .min_dimensions(320, 320)
        .dark_color(qrcode::render::svg::Color("#111827"))
        .light_color(qrcode::render::svg::Color("#ffffff"))
        .build())
}

async fn read_response_limited(
    response: reqwest::Response,
    max_bytes: usize,
    label: &str,
) -> anyhow::Result<(reqwest::StatusCode, Vec<u8>)> {
    let status = response.status();
    let mut stream = response.bytes_stream();
    let mut bytes = Vec::new();
    while let Some(chunk) = stream.next().await {
        let chunk = chunk.with_context(|| format!("读取{label}失败"))?;
        if bytes.len().saturating_add(chunk.len()) > max_bytes {
            bail!("{label}超过大小限制");
        }
        bytes.extend_from_slice(&chunk);
    }
    Ok((status, bytes))
}

impl WeixinMessage {
    pub fn is_finished_user_message(&self) -> bool {
        self.message_type == 1 && self.message_state == 2 && !self.from_user_id.trim().is_empty()
    }

    pub fn text(&self) -> Option<String> {
        self.item_list.iter().find_map(message_item_text)
    }

    pub fn dedup_key(&self) -> String {
        format!(
            "{}|{}|{}|{}|{}",

View on GitHub (pinned to b1ed92e5e4)