{"record":{"id":"8d92bc92dfa8111f","repo":"tinyhumansai/openhuman","slug":"missing-prompt-parameter","errorCode":null,"errorMessage":"Missing 'prompt' parameter","messagePattern":"Missing 'prompt' parameter","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/openhuman/agent/tools/delegate.rs","lineNumber":136,"sourceCode":"        })\n    }\n\n    async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {\n        let agent_name = args\n            .get(\"agent\")\n            .and_then(|v| v.as_str())\n            .map(str::trim)\n            .ok_or_else(|| anyhow::anyhow!(\"Missing 'agent' parameter\"))?;\n\n        if agent_name.is_empty() {\n            return Ok(ToolResult::error(\"'agent' parameter must not be empty\"));\n        }\n\n        let prompt = args\n            .get(\"prompt\")\n            .and_then(|v| v.as_str())\n            .map(str::trim)\n            .ok_or_else(|| anyhow::anyhow!(\"Missing 'prompt' parameter\"))?;\n\n        if prompt.is_empty() {\n            return Ok(ToolResult::error(\"'prompt' parameter must not be empty\"));\n        }\n\n        let context = args\n            .get(\"context\")\n            .and_then(|v| v.as_str())\n            .map(str::trim)\n            .unwrap_or(\"\");\n\n        // Look up agent config\n        let agent_config = match self.agents.get(agent_name) {\n            Some(cfg) => cfg,\n            None => {\n                let available: Vec<&str> =\n                    self.agents.keys().map(|s: &String| s.as_str()).collect();\n                return Ok(ToolResult::error(format!(","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/src/openhuman/agent/tools/delegate.rs#L118-L154","documentation":"The `delegate` agent tool was invoked without a usable `prompt` argument: args[\"prompt\"] is absent or not a JSON string (delegate.rs:136). prompt is the task text handed to the delegated agent and is marked required in the schema. As with agent, the whitespace-only case is a separate soft ToolResult::error — this anyhow error means the key is missing entirely or not a string.","triggerScenarios":"Model calls delegate with only the agent id; prompt passed as a structured object or array instead of a string; caller key mismatch (task/text instead of prompt).","commonSituations":"Models trying to reference an earlier message instead of restating the task; wrapper code building partial args; truncated JSON from a streaming tool-call parser.","solutions":["Include \"prompt\" as a non-empty string restating the full task for the delegated agent","Check the caller serializes the prompt key exactly (prompt, not task/text/instructions)","Validate args against the tool schema before dispatch in wrappers","Return the error to the model as tool feedback so the next attempt includes it"],"exampleFix":"// before\n{ \"agent\": \"indexer\" }\n\n// after\n{ \"agent\": \"indexer\", \"prompt\": \"Index this repository and summarize module layout\" }","handlingStrategy":"type-guard","validationCode":"const a = args as Record<string, unknown>;\nif (typeof a?.prompt !== \"string\" || (a.prompt as string).trim() === \"\") {\n  throw new Error(\"delegate: 'prompt' must be a non-empty string\");\n}","typeGuard":"function hasDelegatePrompt(a: unknown): a is { prompt: string } {\n  return typeof (a as Record<string, unknown>)?.prompt === \"string\"\n      && ((a as { prompt: string }).prompt.trim().length > 0);\n}","tryCatchPattern":"if let Err(e) = tool.execute(args).await {\n    if e.to_string().contains(\"Missing 'prompt'\") {\n        return Ok(ToolResult::error(\"restate the full task in 'prompt' and retry\"));\n    }\n    return Err(e);\n}","preventionTips":["Prompt the model to restate the full task in prompt rather than reference prior turns","Validate both required fields together before dispatch","Watch for truncated JSON from streaming tool-call parsers"],"tags":["rust","tool","arguments","llm","delegation"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}