{"record":{"id":"f09148af08e24d72","repo":"moghtech/komodo","slug":"e-f09148","errorCode":null,"errorMessage":"{e:?}","messagePattern":"\\{e:\\?\\}","errorType":"http","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"client/core/rs/src/request.rs","lineNumber":226,"sourceCode":"    let req = self\n      .reqwest\n      .post(format!(\"{}{endpoint}\", self.address))\n      .header(\"x-api-key\", &self.key)\n      .header(\"x-api-secret\", &self.secret)\n      .header(\"content-type\", \"application/json\")\n      .json(&body);\n    let res =\n      req.send().await.context(\"failed to reach Komodo API\")?;\n    let status = res.status();\n    if status.is_success() {\n      match res.json().await {\n        Ok(res) => Ok(res),\n        Err(e) => Err(anyhow!(\"{e:#?}\").context(status)),\n      }\n    } else {\n      match res.text().await {\n        Ok(res) => Err(deserialize_error(res).context(status)),\n        Err(e) => Err(anyhow!(\"{e:?}\").context(status)),\n      }\n    }\n  }\n\n  #[cfg(feature = \"blocking\")]\n  fn post<B: Serialize + std::fmt::Debug, R: DeserializeOwned>(\n    &self,\n    endpoint: &str,\n    body: B,\n  ) -> anyhow::Result<R> {\n    let req = self\n      .reqwest\n      .post(format!(\"{}{endpoint}\", self.address))\n      .header(\"x-api-key\", &self.key)\n      .header(\"x-api-secret\", &self.secret)\n      .header(\"content-type\", \"application/json\")\n      .json(&body);\n    let res = req.send().context(\"failed to reach Komodo API\")?;","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/moghtech/komodo/blob/780ac68b992094a9fccd5fffb760e0c84fd3c3d1/client/core/rs/src/request.rs#L208-L244","documentation":"In the same async post helper, when the HTTP status is NOT success, the client reads the body as text and passes it to deserialize_error (extracting a server error message). If even that text extraction fails, the anyhow error {e:?} with the status attached is returned. Rare: means reading the response body itself failed.","triggerScenarios":"Non-2xx response where res.text().await fails — connection dropped mid-body, decompression error, or body streaming failure on an error response.","commonSituations":"Flaky networks or proxies closing the connection mid-error-response; server crashing while returning an error; timeouts truncating the body.","solutions":["Retry the request; the underlying network stream failed mid-response","Check network path (proxy, LB) for premature connection closes","Inspect server logs for the failing request to see the original error status","Increase timeouts if the server is slow to produce error responses"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for attempt in 0..3 {\n    match client.read(req.clone()).await {\n        Ok(r) => return Ok(r),\n        Err(e) if attempt < 2 && is_network_error(&e) => { tokio::time::sleep(delay).await; }\n        Err(e) => return Err(e),\n    }\n}","preventionTips":["Add retry with backoff for transient body-read failures","Check proxy/LB timeout settings","Monitor connection resets on the client host"],"tags":["http","network","body-read"],"backgroundTag":"network-request-failed","analyzedSha":"780ac68b992094a9fccd5fffb760e0c84fd3c3d1","analyzedAt":"2026-09-08T10:02:44.861Z","contentChangedAt":"2026-09-08T10:02:44.861Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}