{"record":{"id":"9d2483de39028d87","repo":"BigPizzaV3/CodexPlusPlus","slug":"http-status-9d2483","errorCode":null,"errorMessage":"查询微信扫码状态失败：HTTP {status}","messagePattern":"查询微信扫码状态失败：HTTP (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/connect/weixin.rs","lineNumber":194,"sourceCode":"            .get(url)\n            .headers(client.route_headers(true)?)\n            .timeout(Duration::from_secs(40))\n            .send()\n            .await;\n        let response = match response {\n            Ok(response) => response,\n            Err(error) if error.is_timeout() => {\n                return Ok(WeixinQrStatus {\n                    status: \"wait\".to_string(),\n                    ..WeixinQrStatus::default()\n                });\n            }\n            Err(error) => return Err(error).context(\"查询微信扫码状态失败\"),\n        };\n        let (status, bytes) =\n            read_response_limited(response, MAX_SMALL_RESPONSE_BYTES, \"微信扫码状态\").await?;\n        if !status.is_success() {\n            bail!(\"查询微信扫码状态失败：HTTP {status}\");\n        }\n        serde_json::from_slice(&bytes).context(\"微信扫码状态响应格式无效\")\n    }\n\n    pub async fn get_updates(\n        &self,\n        get_updates_buf: &str,\n        timeout_ms: u64,\n    ) -> anyhow::Result<WeixinUpdates> {\n        let request_body = json!({\n            \"get_updates_buf\": get_updates_buf,\n            \"base_info\": { \"channel_version\": CHANNEL_VERSION }\n        });\n        let timeout_ms = timeout_ms.clamp(1_000, 60_000);\n        let response = self\n            .client\n            .post(self.endpoint(\"ilink/bot/getupdates\")?)\n            .headers(self.auth_headers()?)","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/connect/weixin.rs#L176-L212","documentation":"poll_qr_status queries whether the user scanned/confirmed the WeChat QR login; after reading the size-capped response it checks HTTP success and bails with this message on a non-2xx status. Transport failures are wrapped with a separate context ('查询微信扫码状态失败'), while this variant carries the actual HTTP status.","triggerScenarios":"Calling poll_qr_status while the WeChat status endpoint returns 4xx/5xx — e.g. expired/invalid login session token, rate limiting from polling too fast, or server-side errors.","commonSituations":"Polling interval too aggressive causing 429; login session expired mid-poll (401/403); WeChat API outage (5xx); wrong base_url.","solutions":["Honor the status code: 429 → increase polling interval; 401/403 → restart QR login to get a fresh session","Add backoff between poll_qr_status calls rather than tight-looping","Retry on 5xx with exponential backoff","Verify base_url and that the login flow that produced the session token completed"],"exampleFix":"// before\nloop {\n    let st = client.poll_qr_status(base_url, &token).await?; // hard-fails on 429\n}\n// after\nloop {\n    match client.poll_qr_status(base_url, &token).await {\n        Ok(st) => { if st.confirmed { break st; } }\n        Err(e) if is_rate_limited(&e) => tokio::time::sleep(Duration::from_secs(5)).await,\n        Err(e) => return Err(e),\n    }\n    tokio::time::sleep(Duration::from_millis(1000)).await;\n}","handlingStrategy":"retry","validationCode":"// keep a sane polling interval before calling poll_qr_status\nanyhow::ensure!(since_last_poll >= Duration::from_millis(1000), \"轮询过快\");","typeGuard":null,"tryCatchPattern":"match poll_qr_status(base_url, &token).await {\n    Err(e) if e.to_string().contains(\"HTTP 429\") => { sleep(5s).await; continue; }\n    Err(e) if e.to_string().contains(\"HTTP 40\") => return Err(anyhow!(\"会话失效，请重新扫码\")),\n    other => other?,\n}","preventionTips":["Poll at >=1s intervals; back off on 429","Refresh session via QR login on 401/403","Add jitter to polling to avoid thundering herd","Cap total poll duration with a QR-expiry timeout"],"tags":["http","wechat","polling","rate-limit"],"backgroundTag":"http-error-response","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}