{"record":{"id":"4cf11bde8336c506","repo":"zeroclaw-labs/zeroclaw","slug":"ms365-onedrive-download-failed-status-code-c","errorCode":null,"errorMessage":"ms365: onedrive_download failed ({status}, code={code})","messagePattern":"ms365: onedrive_download failed \\((.+?), code=(.+?)\\)","errorType":"http","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-tools/src/microsoft365/graph_client.rs","lineNumber":350,"sourceCode":"\n    let resp = client\n        .get(&url)\n        .bearer_auth(token)\n        .send()\n        .await\n        .context(\"ms365: onedrive_download request failed\")?;\n\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!({\"body\": body})),\n            \"ms365: onedrive_download raw error body\"\n        );\n        anyhow::bail!(\"ms365: onedrive_download failed ({status}, code={code})\");\n    }\n\n    let bytes = resp\n        .bytes()\n        .await\n        .context(\"ms365: failed to read download body\")?;\n    if bytes.len() > max_size {\n        anyhow::bail!(\n            \"ms365: downloaded file exceeds max_size ({} > {max_size})\",\n            bytes.len()\n        );\n    }\n\n    Ok(bytes.to_vec())\n}\n\n/// Search SharePoint for documents matching a query.\npub async fn sharepoint_search(","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-tools/src/microsoft365/graph_client.rs#L332-L368","documentation":"Error \"ms365: onedrive_download failed ({status}, code={code})\" thrown in zeroclaw-labs/zeroclaw.","triggerScenarios":"Thrown at crates/zeroclaw-tools/src/microsoft365/graph_client.rs:350 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the Graph error code; verify the OneDrive item ID and Files.Read permission."],"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"}