{"record":{"id":"3541cf5f772528ca","repo":"BigPizzaV3/CodexPlusPlus","slug":"ret-errcode-3541cf","errorCode":null,"errorMessage":"发送微信回复被拒绝：ret={} errcode={} {}","messagePattern":"发送微信回复被拒绝：ret=(.+?) errcode=(.+?) (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/connect/weixin.rs","lineNumber":306,"sourceCode":"            .post(self.endpoint(\"ilink/bot/sendmessage\")?)\n            .headers(self.auth_headers()?)\n            .json(&request_body)\n            .timeout(Duration::from_secs(15))\n            .send()\n            .await\n            .context(\"发送微信回复失败\")?;\n        let (http_status, bytes) =\n            read_response_limited(response, MAX_SMALL_RESPONSE_BYTES, \"微信发送响应\").await?;\n        if !http_status.is_success() {\n            bail!(\"发送微信回复失败：HTTP {http_status}\");\n        }\n        if bytes.iter().all(u8::is_ascii_whitespace) {\n            return Ok(());\n        }\n        let result: WeixinSendResponse =\n            serde_json::from_slice(&bytes).context(\"微信发送响应格式无效\")?;\n        if result.ret != 0 || result.errcode != 0 {\n            bail!(\n                \"发送微信回复被拒绝：ret={} errcode={} {}\",\n                result.ret,\n                result.errcode,\n                result.errmsg\n            );\n        }\n        Ok(())\n    }\n\n    fn endpoint(&self, path: &str) -> anyhow::Result<reqwest::Url> {\n        let base = format!(\"{}/\", self.base_url.trim_end_matches('/'));\n        reqwest::Url::parse(&base)?\n            .join(path.trim_start_matches('/'))\n            .context(\"微信 API 地址无效\")\n    }\n\n    fn auth_headers(&self) -> anyhow::Result<HeaderMap> {\n        let mut headers = self.route_headers(false)?;","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/connect/weixin.rs#L288-L324","documentation":"The WeChat API returned HTTP success but the JSON body indicates a business-level rejection: the WeixinSendResponse has a non-zero ret or errcode (with errmsg detail). The library treats ret!=0 || errcode!=0 as a failed send and surfaces all three fields in the message.","triggerScenarios":"send_text parses the response body into WeixinSendResponse; any body where result.ret != 0 or result.errcode != 0 triggers this bail. Typical errcodes: invalid session, content rejected, frequency limit.","commonSituations":"WeChat session expired after QR re-login lapse, message content flagged/blocked by WeChat, sending too frequently, or sending to an invalid/disconnected conversation.","solutions":["Inspect errmsg/errcode in the message; look up the WeChat error code to identify the specific rejection.","Re-login the WeChat session (re-scan QR) if the errcode indicates session/token invalidity.","Reduce send frequency / batch replies if the error is a rate/frequency limit.","Sanitize or shorten message content if the rejection is content-related."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Rust\nif let Err(e) = connector.send_text(text).await {\n    let msg = e.to_string();\n    if msg.contains(\"发送微信回复被拒绝\") {\n        // parse ret/errcode/errmsg, branch on errcode:\n        // session invalid -> re-login; content blocked -> sanitize; frequency -> backoff\n    }\n}","preventionTips":["Keep the WeChat session alive (periodic heartbeat/re-login prompts)","Throttle outgoing messages below WeChat frequency limits","Sanitize message content against blocked patterns before sending"],"tags":["weixin","api-error","business-logic"],"backgroundTag":"api-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"}