BigPizzaV3/CodexPlusPlus · error · anyhow::Error
获取微信登录二维码失败:HTTP {status}
Error message
获取微信登录二维码失败:HTTP {status} What it means
fetch_qr_code GETs the ilink bot QR endpoint with a 40s timeout and a size-limited body to obtain a WeChat login QR code; a non-2xx HTTP status aborts with this error. Transport-level failures surface separately through context, so this is specifically an HTTP error status from the gateway.
Source
Thrown at crates/codex-plus-core/src/connect/weixin.rs:157
})
}
pub async fn fetch_qr_code(base_url: &str, route_tag: &str) -> anyhow::Result<WeixinQrCode> {
let client = Self::new(base_url, "", route_tag)?;
let mut url = client.endpoint("ilink/bot/get_bot_qrcode")?;
url.query_pairs_mut().append_pair("bot_type", "3");
let response = client
.client
.get(url)
.headers(client.route_headers(false)?)
.timeout(Duration::from_secs(40))
.send()
.await
.context("获取微信登录二维码失败")?;
let (status, bytes) =
read_response_limited(response, MAX_SMALL_RESPONSE_BYTES, "微信二维码").await?;
if !status.is_success() {
bail!("获取微信登录二维码失败:HTTP {status}");
}
let qr: WeixinQrCode = serde_json::from_slice(&bytes).context("微信二维码响应格式无效")?;
if qr.qr_code.trim().is_empty() || qr.qr_content.trim().is_empty() {
bail!("微信二维码响应缺少必要字段");
}
Ok(qr)
}
pub async fn poll_qr_status(
base_url: &str,
route_tag: &str,
qr_code: &str,
) -> anyhow::Result<WeixinQrStatus> {
let client = Self::new(base_url, "", route_tag)?;
let mut url = client.endpoint("ilink/bot/get_qrcode_status")?;
url.query_pairs_mut().append_pair("qrcode", qr_code);
let response = client
.clientView on GitHub (pinned to f2074595a2)
Solutions
- Verify base_url reaches the ilink gateway by requesting the endpoint directly and checking the status
- Confirm route_tag and the bot_type query match the working manager build
- Retry after a short wait for transient 5xx and inspect the body via a proxy for 4xx cause
- Update codex-plus-manager if the endpoint contract changed
Defensive patterns
Strategy: retry
Validate before calling
// prove the endpoint is reachable and 2xx before showing UI
let probe = reqwest::Client::new().get(format!("{base}/ilink/bot/get_bot_qrcode?bot_type=3")).send().await?;
ensure!(probe.status().is_success(), "gateway unhealthy"); Try / catch
let qr = match WeixinClient::fetch_qr_code(&base, &tag).await {
Ok(qr) => qr,
Err(e) if e.to_string().contains("HTTP ") => {
tokio::time::sleep(Duration::from_secs(2)).await;
WeixinClient::fetch_qr_code(&base, &tag).await?
}
Err(e) => return Err(e),
}; Prevention
- Validate base_url at config save time
- Retry QR fetches with backoff, gateway 5xx is common in maintenance
- Keep route_tag in sync with the manager build
When it happens
Trigger: base_url points at the wrong gateway or a mistyped host (404); the route tag or bot identity is rejected (4xx); the WeChat ilink service returns 5xx during maintenance.
Common situations: Typo in base_url; gateway endpoint moved; rate-limited or region-blocked IP; corporate proxy returning 407 or 502.
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
- 查询微信扫码状态失败:HTTP {status}
- 微信二维码响应缺少必要字段
- 微信长轮询请求失败:HTTP {http_status}
- 发送微信回复失败:HTTP {http_status}
- 请先扫码登录微信
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@f2074595a2 (2026-08-23).
Data as JSON: /api/errors/6ffa4960441a301d.
Report an issue: GitHub.