BigPizzaV3/CodexPlusPlus · error
微信长轮询请求失败:HTTP
Error message
微信长轮询请求失败:HTTP {http_status} What it means
get_updates performs a long-poll for new WeChat messages; when the HTTP response status is not success it bails with this message including the status. The body-size-capped read succeeds but the status check rejects it, so no deserialization is attempted. Transport-level errors carry a different context ('微信长轮询请求失败' via .context).
Solutions
- Inspect the status: 401/403 → re-run QR login for a fresh token; 429 → slow the poll loop; 5xx/504 → retry with backoff
- Ensure any reverse proxy in front allows long-poll durations (raise proxy read timeout)
- Verify the device/token pairing hasn't been invalidated by a parallel login
- Add retry-with-backoff around get_updates in the polling loop
Example fix
// before
let updates = client.get_updates(&token, &cursor).await?; // aborts poll loop on any 5xx
// after
let updates = match client.get_updates(&token, &cursor).await {
Err(e) if e.to_string().contains("HTTP 5") => { backoff().await; continue; }
Err(e) if e.to_string().contains("HTTP 401") => return Err(anyhow!("登录失效,请重新扫码")),
other => other?,
}; Defensive patterns
Strategy: retry
Validate before calling
// ensure the token is present before long-polling anyhow::ensure!(!token.trim().is_empty(), "长轮询前需要有效会话 token");
Try / catch
match get_updates(&token, &cursor).await {
Err(e) if e.to_string().contains("HTTP 5") || e.to_string().contains("HTTP 504") => { backoff().await; continue; }
Err(e) if e.to_string().contains("HTTP 401") => restart_login(),
other => other?,
} Prevention
- Configure proxies to tolerate long-poll durations
- Back off on 5xx instead of tight-looping
- Re-login on auth statuses instead of hammering
- Monitor poll error rates for API regressions
When it happens
Trigger: Calling get_updates when the WeChat long-poll endpoint returns 4xx/5xx: invalid/expired token, over-frequent polling (429), or server errors; also proxies intercepting with 502/504.
Common situations: Token expired after re-login elsewhere (401); polling loop too tight (429); gateway timeouts on long-poll (504) from aggressive proxy timeouts shorter than the long-poll window.
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/db18fda5de281421.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/connect/weixin.rs:234
.await;
let response = match response {
Ok(response) => response,
Err(error) if error.is_timeout() => {
return Ok(WeixinUpdates {
ret: 0,
errcode: 0,
errmsg: String::new(),
messages: Vec::new(),
get_updates_buf: get_updates_buf.to_string(),
longpolling_timeout_ms: timeout_ms,
});
}
Err(error) => return Err(error).context("微信长轮询请求失败"),
};
let (http_status, bytes) =
read_response_limited(response, MAX_API_RESPONSE_BYTES, "微信长轮询").await?;
if !http_status.is_success() {
bail!("微信长轮询请求失败:HTTP {http_status}");
}
let updates: WeixinUpdates =
serde_json::from_slice(&bytes).context("微信长轮询响应格式无效")?;
if updates.ret != 0 || updates.errcode != 0 {
bail!(
"微信长轮询被拒绝:ret={} errcode={} {}",
updates.ret,
updates.errcode,
updates.errmsg
);
}
Ok(updates)
}
pub async fn send_text_chunks(
&self,
to_user_id: &str,
text: &str,View on GitHub (pinned to b1ed92e5e4)