tinyhumansai/openhuman · error · anyhow::Error

missing required field

Error message

missing required field `{key}`

What it means

Generic required-argument helper for the todo tool: the named key (e.g. `id`, `status`) is absent from the tool args or is not a JSON string. Every required_string call site shares this one message with the key interpolated; it fires before any board operation runs.

Solutions

  1. Include the named key as a non-empty string in the tool arguments
  2. Check the tool's parameter schema for which keys are required per op
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/agent/tools/todo.rs:233 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/35bd73f5f666d940. Report an issue: GitHub.

Appendix: source

Thrown at src/openhuman/agent/tools/todo.rs:233

        return BoardLocation::Thread {
            workspace_dir: parent.workspace_dir.clone(),
            thread_id: ops::ORCHESTRATOR_TASKS_THREAD_ID.to_string(),
        };
    }
    let Some(thread_id) = thread_context::current_thread_id() else {
        return BoardLocation::Scratch;
    };
    BoardLocation::Thread {
        workspace_dir: parent.workspace_dir.clone(),
        thread_id,
    }
}

fn required_string(args: &serde_json::Value, key: &str) -> anyhow::Result<String> {
    let value = args
        .get(key)
        .and_then(|v| v.as_str())
        .ok_or_else(|| anyhow::anyhow!("missing required field `{key}`"))?;
    let trimmed = value.trim();
    if trimmed.is_empty() {
        return Err(anyhow::anyhow!("missing required field `{key}`"));
    }
    Ok(trimmed.to_string())
}

fn optional_string(args: &serde_json::Value, key: &str) -> Option<String> {
    args.get(key)
        .and_then(|v| v.as_str())
        .map(|s| s.to_string())
}

fn patch_from_args(args: &serde_json::Value) -> anyhow::Result<CardPatch> {
    let status: Option<TaskCardStatus> = match args.get("status").and_then(|v| v.as_str()) {
        Some(s) => Some(ops::parse_status(s).map_err(anyhow::Error::msg)?),
        None => None,
    };

View on GitHub (pinned to 7491200858)