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

' ' must not be empty

Error message

'{field}' must not be empty

What it means

Generic validation helper used when parsing delegate-agent upsert arguments. It fires when the named field is absent from the JSON arguments, is not a JSON string, or is present but empty. Because it is a shared guard, the field name in the message identifies the actual input at fault (e.g. 'name', 'model'). Supply the required field as a non-empty string.

Solutions

  1. Provide a non-empty value for the field.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/zeroclaw-tools/src/model_routing_config.rs:186 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/81fbd31ad598e699. Report an issue: GitHub.

Appendix: source

Thrown at crates/zeroclaw-tools/src/model_routing_config.rs:186

    fn parse_non_empty_string(args: &Value, field: &str) -> anyhow::Result<String> {
        let value = args
            .get(field)
            .and_then(Value::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)
                        .with_attrs(::serde_json::json!({"param": field})),
                    "model_routing_config: missing required string param"
                );
                anyhow::Error::msg(format!("Missing '{field}'"))
            })?
            .trim();

        if value.is_empty() {
            anyhow::bail!("'{field}' must not be empty");
        }

        Ok(value.to_string())
    }

    fn parse_optional_string_update(args: &Value, field: &str) -> anyhow::Result<MaybeSet<String>> {
        let Some(raw) = args.get(field) else {
            return Ok(MaybeSet::Unset);
        };

        if raw.is_null() {
            return Ok(MaybeSet::Null);
        }

        let value = raw
            .as_str()
            .ok_or_else(|| {
                ::zeroclaw_log::record!(

View on GitHub (pinned to 88bb9c8533)