{"record":{"id":"49b36405e1ebfa14","repo":"zeroclaw-labs/zeroclaw","slug":"ms365-operation-failed-status-code-code","errorCode":null,"errorMessage":"ms365: {operation} failed ({status}, code={code})","messagePattern":"ms365: (.+?) failed \\((.+?), code=(.+?)\\)","errorType":"http","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-tools/src/microsoft365/graph_client.rs","lineNumber":427,"sourceCode":"/// Parse a JSON response body, returning an error on non-success status.\n/// Raw Graph API error bodies are not propagated; only the HTTP status and a\n/// short error code (when available) are surfaced to avoid leaking internal\n/// API details.\nasync fn handle_json_response(\n    resp: reqwest::Response,\n    operation: &str,\n) -> anyhow::Result<serde_json::Value> {\n    if !resp.status().is_success() {\n        let status = resp.status();\n        let body = resp.text().await.unwrap_or_default();\n        let code = extract_graph_error_code(&body).unwrap_or_else(|| \"unknown\".to_string());\n        ::zeroclaw_log::record!(\n            DEBUG,\n            ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note)\n                .with_attrs(::serde_json::json!({\"operation\": operation, \"body\": body})),\n            \"ms365: raw error body\"\n        );\n        anyhow::bail!(\"ms365: {operation} failed ({status}, code={code})\");\n    }\n\n    resp.json()\n        .await\n        .with_context(|| format!(\"ms365: failed to parse {operation} response\"))\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn user_path_me() {\n        assert_eq!(user_path(\"me\"), \"/me\");\n    }\n\n    #[test]\n    fn user_path_specific_user() {","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-tools/src/microsoft365/graph_client.rs#L409-L445","documentation":"Error \"ms365: {operation} failed ({status}, code={code})\" thrown in zeroclaw-labs/zeroclaw.","triggerScenarios":"Thrown at crates/zeroclaw-tools/src/microsoft365/graph_client.rs:427 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the Graph error code for the operation; verify permissions and request parameters."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}