{"record":{"id":"5067f1a4f2a0d417","repo":"zeroclaw-labs/zeroclaw","slug":"ms365-downloaded-file-exceeds-max-size-max","errorCode":null,"errorMessage":"ms365: downloaded file exceeds max_size ({} > {max_size})","messagePattern":"ms365: downloaded file exceeds max_size \\((.+?) > (.+?)\\)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-tools/src/microsoft365/graph_client.rs","lineNumber":358,"sourceCode":"    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(\n    client: &reqwest::Client,\n    token: &str,\n    query: &str,\n    top: u32,\n) -> anyhow::Result<serde_json::Value> {\n    let url = format!(\"{GRAPH_BASE}/search/query\");\n\n    let payload = serde_json::json!({","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-tools/src/microsoft365/graph_client.rs#L340-L376","documentation":"Error \"ms365: downloaded file exceeds max_size ({} > {max_size})\" thrown in zeroclaw-labs/zeroclaw.","triggerScenarios":"Thrown at crates/zeroclaw-tools/src/microsoft365/graph_client.rs:358 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Increase max_size for the download or fetch a smaller file."],"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"}