{"record":{"id":"7e258ef30d3f52e1","repo":"zeroclaw-labs/zeroclaw","slug":"field-must-be-a-string-string-or-delegate","errorCode":null,"errorMessage":"'{field}' must be a string, string[], or delegate target object[]","messagePattern":"'(.+?)' must be a string, string\\[\\], or delegate target object\\[\\]","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-tools/src/model_routing_config.rs","lineNumber":166,"sourceCode":"                            .with_attrs(::serde_json::json!({\n                                \"field\": field,\n                                \"error\": format!(\"{}\", error),\n                            })),\n                            \"model_routing_config: delegate target element has invalid shape\"\n                        );\n                        anyhow::Error::msg(format!(\n                            \"'{field}' array must contain strings or objects with agent/mode: {error}\"\n                        ))\n                    })?;\n                target.agent = target.agent.trim().to_string();\n                if !target.agent.is_empty() {\n                    out.push(target);\n                }\n            }\n            return Ok(out);\n        }\n\n        anyhow::bail!(\"'{field}' must be a string, string[], or delegate target object[]\")\n    }\n\n    fn parse_non_empty_string(args: &Value, field: &str) -> anyhow::Result<String> {\n        let value = args\n            .get(field)\n            .and_then(Value::as_str)\n            .ok_or_else(|| {\n                ::zeroclaw_log::record!(\n                    WARN,\n                    ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Reject)\n                        .with_outcome(::zeroclaw_log::EventOutcome::Failure)\n                        .with_attrs(::serde_json::json!({\"param\": field})),\n                    \"model_routing_config: missing required string param\"\n                );\n                anyhow::Error::msg(format!(\"Missing '{field}'\"))\n            })?\n            .trim();\n","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-tools/src/model_routing_config.rs#L148-L184","documentation":"Error \"'{field}' must be a string, string[], or delegate target object[]\" thrown in zeroclaw-labs/zeroclaw.","triggerScenarios":"Thrown at crates/zeroclaw-tools/src/model_routing_config.rs:166 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide the field as a string, string[], or an array of delegate target objects."],"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"}