tinyhumansai/openhuman · error · anyhow::Error

invalid approvalMode type (expected…

Error message

invalid approvalMode type (expected required|not_required|null)

What it means

The todo tool received an `approvalMode` that is neither a string nor JSON null (e.g. a number or object). Type guard in patch_from_args: null clears the mode, strings are matched against the two literal values, and any other JSON type falls through to this error before the patch is applied.

Solutions

  1. Pass approvalMode as a string ("required"/"not_required") or null
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at src/openhuman/agent/tools/todo.rs:263 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/966f1b2053a17aa9. Report an issue: GitHub.

Appendix: source

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

}

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,
    };
    let approval_mode = match args.get("approvalMode") {
        Some(value) if value.is_null() => Some(None),
        Some(value) => match value.as_str() {
            Some("required") => Some(Some(TaskApprovalMode::Required)),
            Some("not_required") => Some(Some(TaskApprovalMode::NotRequired)),
            Some(other) => {
                return Err(anyhow::anyhow!(
                    "invalid approvalMode '{other}' (expected required|not_required|null)"
                ))
            }
            None => {
                return Err(anyhow::anyhow!(
                    "invalid approvalMode type (expected required|not_required|null)"
                ))
            }
        },
        None => None,
    };
    Ok(CardPatch {
        content: None,
        status,
        objective: optional_string(args, "objective"),
        plan: optional_string_array(args, "plan")?,
        assigned_agent: optional_string(args, "assignedAgent"),
        allowed_tools: optional_string_array(args, "allowedTools")?,
        approval_mode,
        acceptance_criteria: optional_string_array(args, "acceptanceCriteria")?,
        evidence: optional_string_array(args, "evidence")?,
        notes: optional_string(args, "notes"),
        blocker: optional_string(args, "blocker"),

View on GitHub (pinned to 7491200858)