{"record":{"id":"2ae388052c30991c","repo":"moghtech/komodo","slug":"e","errorCode":null,"errorMessage":"{e:#?}","messagePattern":"\\{e:#\\?\\}","errorType":"http","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"client/core/rs/src/request.rs","lineNumber":221,"sourceCode":"  >(\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 =\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))","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/moghtech/komodo/blob/780ac68b992094a9fccd5fffb760e0c84fd3c3d1/client/core/rs/src/request.rs#L203-L239","documentation":"In the async post helper, after a successful HTTP status the client tries res.json(). If the response body cannot be deserialized into the expected type R, the anyhow error is formatted with {e:#?} and the HTTP status attached as context. So the request 'succeeded' at HTTP level but the payload didn't match the expected shape/type.","triggerScenarios":"API returns 2xx but body is not the expected JSON structure — wrong request path, API returning an error object inside a 200, or client struct R out of sync with server response type; also non-JSON bodies (HTML error pages) with 2xx.","commonSituations":"Komodo client/server version mismatch (types changed); calling read/write/execute/auth_login/auth_manage against a proxy that alters responses; typo'd request leading to an unexpected 2xx body.","solutions":["Compare the Debug dump in the message against the expected response struct; fix the mismatched field/type","Check that client and Komodo server versions match and regenerate/update client types","Verify the URL/endpoint and feature flags; hit the endpoint manually (curl) to inspect the raw body","If status context shows a 2xx but body looks like an error, check middleware/proxies"],"exampleFix":"// before\nlet res: UpdateTargetResponse = client.read(ReadRequest::GetTarget { id })\n    .await?;\n// after\nmatch client.read::<serde_json::Value>(ReadRequest::GetTarget { id: target_id.clone() }).await {\n    Ok(v) => serde_json::from_value::<UpdateTargetResponse>(v)\n        .with_context(|| format!(\"unexpected response shape: {v}\"))?,\n    Err(e) => return Err(e.context(\"GetTarget failed; inspect response shape\")),\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match client.read(req).await {\n    Ok(res) => ...,\n    Err(e) if e.to_string().contains(\"Json(\") || format!(\"{e:#}\").contains(\"expected\") => {\n        eprintln!(\"response shape mismatch: {e:#?}\");\n        // inspect raw body / check client-server version\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Pin client version to the Komodo server version","Fetch into serde_json::Value first when response shapes are uncertain","Curl new endpoints before wiring typed clients"],"tags":["http","json","deserialization","komodo-client"],"backgroundTag":"unexpected-response-shape","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"}