zeroclaw-labs/zeroclaw · error · anyhow::Error

ms365: {operation} failed ({status}, code={code})

Error message

ms365: {operation} failed ({status}, code={code})

What it means

Error "ms365: {operation} failed ({status}, code={code})" thrown in zeroclaw-labs/zeroclaw.

Source

Thrown at crates/zeroclaw-tools/src/microsoft365/graph_client.rs:427

/// Parse a JSON response body, returning an error on non-success status.
/// Raw Graph API error bodies are not propagated; only the HTTP status and a
/// short error code (when available) are surfaced to avoid leaking internal
/// API details.
async fn handle_json_response(
    resp: reqwest::Response,
    operation: &str,
) -> anyhow::Result<serde_json::Value> {
    if !resp.status().is_success() {
        let status = resp.status();
        let body = resp.text().await.unwrap_or_default();
        let code = extract_graph_error_code(&body).unwrap_or_else(|| "unknown".to_string());
        ::zeroclaw_log::record!(
            DEBUG,
            ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note)
                .with_attrs(::serde_json::json!({"operation": operation, "body": body})),
            "ms365: raw error body"
        );
        anyhow::bail!("ms365: {operation} failed ({status}, code={code})");
    }

    resp.json()
        .await
        .with_context(|| format!("ms365: failed to parse {operation} response"))
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn user_path_me() {
        assert_eq!(user_path("me"), "/me");
    }

    #[test]
    fn user_path_specific_user() {

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Check the Graph error code for the operation; verify permissions and request parameters.

When it happens

Trigger: Thrown at crates/zeroclaw-tools/src/microsoft365/graph_client.rs:427 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/49b36405e1ebfa14. Report an issue: GitHub.