{"record":{"id":"6ffa4960441a301d","repo":"BigPizzaV3/CodexPlusPlus","slug":"http-status","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":157,"sourceCode":"        })\n    }\n\n    pub async fn fetch_qr_code(base_url: &str, route_tag: &str) -> anyhow::Result<WeixinQrCode> {\n        let client = Self::new(base_url, \"\", route_tag)?;\n        let mut url = client.endpoint(\"ilink/bot/get_bot_qrcode\")?;\n        url.query_pairs_mut().append_pair(\"bot_type\", \"3\");\n        let response = client\n            .client\n            .get(url)\n            .headers(client.route_headers(false)?)\n            .timeout(Duration::from_secs(40))\n            .send()\n            .await\n            .context(\"获取微信登录二维码失败\")?;\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        let qr: WeixinQrCode = serde_json::from_slice(&bytes).context(\"微信二维码响应格式无效\")?;\n        if qr.qr_code.trim().is_empty() || qr.qr_content.trim().is_empty() {\n            bail!(\"微信二维码响应缺少必要字段\");\n        }\n        Ok(qr)\n    }\n\n    pub async fn poll_qr_status(\n        base_url: &str,\n        route_tag: &str,\n        qr_code: &str,\n    ) -> anyhow::Result<WeixinQrStatus> {\n        let client = Self::new(base_url, \"\", route_tag)?;\n        let mut url = client.endpoint(\"ilink/bot/get_qrcode_status\")?;\n        url.query_pairs_mut().append_pair(\"qrcode\", qr_code);\n        let response = client\n            .client","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/connect/weixin.rs#L139-L175","documentation":"fetch_qr_code calls the WeChat login endpoint to obtain a QR code; after reading the response (with a size cap), it checks HTTP success and bails with this message when the server returned a non-2xx status. The status code is interpolated into the message, and a lower-level context ('获取微信登录二维码失败') wraps transport errors separately.","triggerScenarios":"The HTTP response from the WeChat QR endpoint has a non-success status (4xx/5xx), e.g. service outage, rate limiting, or a wrong base_url hitting an error page.","commonSituations":"WeChat login service temporarily down (5xx); wrong/misconfigured base_url; too many QR requests triggering 429; corporate proxy returning 403/502.","solutions":["Read the HTTP status in the message: 5xx → retry with backoff; 429 → wait before retrying; 4xx → check base_url and request shape","Verify the configured WeChat API base_url is correct","Retry the login flow after a short delay — transient 5xx are common","Check network/proxy interference if statuses like 403/502 appear"],"exampleFix":"// before\nlet qr = client.fetch_qr_code(base_url).await?; // fails on transient 5xx\n// after\nlet qr = retry_with_backoff(3, || client.fetch_qr_code(base_url)).await\n    .or_else(|e| Err(anyhow!(\"二维码获取失败，请检查网络后重试: {e:#}\")))?;","handlingStrategy":"retry","validationCode":"// probe the endpoint health before fetching a QR\nlet health = reqwest::get(format!(\"{base_url}/health\")).await?;\nanyhow::ensure!(health.status().is_success(), \"WeChat 服务不可用\");","typeGuard":null,"tryCatchPattern":"match fetch_qr_code(base_url).await {\n    Err(e) if e.to_string().contains(\"HTTP 5\") => retry_with_backoff(3, fetch_qr_code).await,\n    other => other,\n}","preventionTips":["Retry 5xx/429 with exponential backoff","Validate base_url configuration before login","Surface the HTTP status to users for triage","Watch WeChat service status during outages"],"tags":["http","wechat","network","login"],"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"}