BigPizzaV3/CodexPlusPlus · error · anyhow::Error

查询微信扫码状态失败:HTTP {status}

Error message

查询微信扫码状态失败:HTTP {status}

What it means

poll_qr_status GETs the QR status endpoint with the qr_code string; request timeouts are deliberately tolerated and reported as status wait, so this error means the gateway answered with a real HTTP error status and the polling iteration aborts.

Source

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

            .get(url)
            .headers(client.route_headers(true)?)
            .timeout(Duration::from_secs(40))
            .send()
            .await;
        let response = match response {
            Ok(response) => response,
            Err(error) if error.is_timeout() => {
                return Ok(WeixinQrStatus {
                    status: "wait".to_string(),
                    ..WeixinQrStatus::default()
                });
            }
            Err(error) => return Err(error).context("查询微信扫码状态失败"),
        };
        let (status, bytes) =
            read_response_limited(response, MAX_SMALL_RESPONSE_BYTES, "微信扫码状态").await?;
        if !status.is_success() {
            bail!("查询微信扫码状态失败:HTTP {status}");
        }
        serde_json::from_slice(&bytes).context("微信扫码状态响应格式无效")
    }

    pub async fn get_updates(
        &self,
        get_updates_buf: &str,
        timeout_ms: u64,
    ) -> anyhow::Result<WeixinUpdates> {
        let request_body = json!({
            "get_updates_buf": get_updates_buf,
            "base_info": { "channel_version": CHANNEL_VERSION }
        });
        let timeout_ms = timeout_ms.clamp(1_000, 60_000);
        let response = self
            .client
            .post(self.endpoint("ilink/bot/getupdates")?)
            .headers(self.auth_headers()?)

View on GitHub (pinned to f2074595a2)

Solutions

  1. Fetch a fresh QR code when the current one is stale or polling keeps failing
  2. Use the same base_url and route headers as the original fetch_qr_code call
  3. Retry with backoff for 5xx and inspect the body for 4xx cause
Defensive patterns

Strategy: retry

Try / catch

let st = match WeixinClient::poll_qr_status(&base, &tag, &qr.qr_code).await {
    Ok(st) => st,
    Err(e) if e.to_string().contains("HTTP ") => {
        let qr = WeixinClient::fetch_qr_code(&base, &tag).await?; // stale code, refresh
        WeixinClient::poll_qr_status(&base, &tag, &qr.qr_code).await?
    }
    Err(e) => return Err(e),
};

Prevention

When it happens

Trigger: Polling with an expired or invalid qrcode value (4xx); gateway 5xx; base_url or route header mismatches versus the ones used to fetch the code.

Common situations: QR code expired server-side while polling continues; IP rate-limited; endpoint changed after a gateway update.

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@f2074595a2 (2026-08-23). Data as JSON: /api/errors/9d2483de39028d87. Report an issue: GitHub.