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

'{field}' must be a string or string[]

Error message

'{field}' must be a string or string[]

What it means

Error "'{field}' must be a string or string[]" thrown in zeroclaw-labs/zeroclaw.

Source

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

                let value = item.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!({"field": field})),
                        "model_routing_config: array element must be a string"
                    );
                    anyhow::Error::msg(format!("'{field}' array must only contain strings"))
                })?;
                let trimmed = value.trim();
                if !trimmed.is_empty() {
                    out.push(trimmed.to_string());
                }
            }
            return Ok(out);
        }

        anyhow::bail!("'{field}' must be a string or string[]")
    }

    fn parse_delegate_targets(
        raw: &Value,
        field: &str,
    ) -> anyhow::Result<Vec<DelegateTargetConfig>> {
        // Keep the config-editing tool as permissive as the schema loader:
        // operators may pass a comma-separated legacy string, a string array,
        // or object entries with explicit mode. The stored config still uses
        // `DelegateTargetConfig`, so mode semantics are not reimplemented here.
        if let Some(raw_string) = raw.as_str() {
            return Ok(raw_string
                .split(',')
                .map(str::trim)
                .filter(|entry| !entry.is_empty())
                .map(DelegateTargetConfig::bounded)
                .collect());
        }

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Provide the field as a string or an array of strings.

When it happens

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