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

to must contain at least one email address

Error message

to must contain at least one email address

What it means

handle_mail_send parsed the tool's 'to' argument and, after filtering to valid entries, no recipient email address remains. Mail send requires at least one recipient; the argument shape (array of addresses) was validated first, then found empty.

Solutions

  1. Add at least one recipient address to the 'to' field.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/zeroclaw-tools/src/microsoft365/mod.rs:369 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/27c1d0b6870b30fb. Report an issue: GitHub.

Appendix: source

Thrown at crates/zeroclaw-tools/src/microsoft365/mod.rs:369

        let token = self.get_token().await?;
        let to: Vec<String> = args["to"]
            .as_array()
            .ok_or_else(|| {
                ::zeroclaw_log::record!(
                    WARN,
                    ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Reject)
                        .with_outcome(::zeroclaw_log::EventOutcome::Failure),
                    "mod: to must be an array of email addresses"
                );
                anyhow::Error::msg("to must be an array of email addresses")
            })?
            .iter()
            .filter_map(|v| v.as_str().map(String::from))
            .collect();

        if to.is_empty() {
            anyhow::bail!("to must contain at least one email address");
        }

        let subject = args["subject"].as_str().ok_or_else(|| {
            ::zeroclaw_log::record!(
                WARN,
                ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Reject)
                    .with_outcome(::zeroclaw_log::EventOutcome::Failure),
                "mod: subject is required"
            );
            anyhow::Error::msg("subject is required")
        })?;
        let body = args["body"].as_str().ok_or_else(|| {
            ::zeroclaw_log::record!(
                WARN,
                ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Reject)
                    .with_outcome(::zeroclaw_log::EventOutcome::Failure),
                "mod: body is required"
            );

View on GitHub (pinned to 88bb9c8533)