tinyhumansai/openhuman · warning

Missing 'prompt' parameter

Error message

Missing 'prompt' parameter

What it means

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.

Source

Thrown at src/openhuman/agent/tools/delegate.rs:136

        })
    }

    async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {
        let agent_name = args
            .get("agent")
            .and_then(|v| v.as_str())
            .map(str::trim)
            .ok_or_else(|| anyhow::anyhow!("Missing 'agent' parameter"))?;

        if agent_name.is_empty() {
            return Ok(ToolResult::error("'agent' parameter must not be empty"));
        }

        let prompt = args
            .get("prompt")
            .and_then(|v| v.as_str())
            .map(str::trim)
            .ok_or_else(|| anyhow::anyhow!("Missing 'prompt' parameter"))?;

        if prompt.is_empty() {
            return Ok(ToolResult::error("'prompt' parameter must not be empty"));
        }

        let context = args
            .get("context")
            .and_then(|v| v.as_str())
            .map(str::trim)
            .unwrap_or("");

        // Look up agent config
        let agent_config = match self.agents.get(agent_name) {
            Some(cfg) => cfg,
            None => {
                let available: Vec<&str> =
                    self.agents.keys().map(|s: &String| s.as_str()).collect();
                return Ok(ToolResult::error(format!(

View on GitHub (pinned to a221052e0d)

Solutions

  1. Include "prompt" as a non-empty string restating the full task for the delegated agent
  2. Check the caller serializes the prompt key exactly (prompt, not task/text/instructions)
  3. Validate args against the tool schema before dispatch in wrappers
  4. Return the error to the model as tool feedback so the next attempt includes it

Example fix

// before
{ "agent": "indexer" }

// after
{ "agent": "indexer", "prompt": "Index this repository and summarize module layout" }
Defensive patterns

Strategy: type-guard

Validate before calling

const a = args as Record<string, unknown>;
if (typeof a?.prompt !== "string" || (a.prompt as string).trim() === "") {
  throw new Error("delegate: 'prompt' must be a non-empty string");
}

Type guard

function hasDelegatePrompt(a: unknown): a is { prompt: string } {
  return typeof (a as Record<string, unknown>)?.prompt === "string"
      && ((a as { prompt: string }).prompt.trim().length > 0);
}

Try / catch

if let Err(e) = tool.execute(args).await {
    if e.to_string().contains("Missing 'prompt'") {
        return Ok(ToolResult::error("restate the full task in 'prompt' and retry"));
    }
    return Err(e);
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of tinyhumansai/openhuman@a221052e0d (2026-08-16). Data as JSON: /api/errors/8d92bc92dfa8111f. Report an issue: GitHub.