{"record":{"id":"966f1b2053a17aa9","repo":"tinyhumansai/openhuman","slug":"invalid-approvalmode-type-expected-required-not-r","errorCode":null,"errorMessage":"invalid approvalMode type (expected required|not_required|null)","messagePattern":"invalid approvalMode type \\(expected required\\|not_required\\|null\\)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/openhuman/agent/tools/todo.rs","lineNumber":263,"sourceCode":"}\n\nfn patch_from_args(args: &serde_json::Value) -> anyhow::Result<CardPatch> {\n    let status: Option<TaskCardStatus> = match args.get(\"status\").and_then(|v| v.as_str()) {\n        Some(s) => Some(ops::parse_status(s).map_err(anyhow::Error::msg)?),\n        None => None,\n    };\n    let approval_mode = match args.get(\"approvalMode\") {\n        Some(value) if value.is_null() => Some(None),\n        Some(value) => match value.as_str() {\n            Some(\"required\") => Some(Some(TaskApprovalMode::Required)),\n            Some(\"not_required\") => Some(Some(TaskApprovalMode::NotRequired)),\n            Some(other) => {\n                return Err(anyhow::anyhow!(\n                    \"invalid approvalMode '{other}' (expected required|not_required|null)\"\n                ))\n            }\n            None => {\n                return Err(anyhow::anyhow!(\n                    \"invalid approvalMode type (expected required|not_required|null)\"\n                ))\n            }\n        },\n        None => None,\n    };\n    Ok(CardPatch {\n        content: None,\n        status,\n        objective: optional_string(args, \"objective\"),\n        plan: optional_string_array(args, \"plan\")?,\n        assigned_agent: optional_string(args, \"assignedAgent\"),\n        allowed_tools: optional_string_array(args, \"allowedTools\")?,\n        approval_mode,\n        acceptance_criteria: optional_string_array(args, \"acceptanceCriteria\")?,\n        evidence: optional_string_array(args, \"evidence\")?,\n        notes: optional_string(args, \"notes\"),\n        blocker: optional_string(args, \"blocker\"),","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/agent/tools/todo.rs#L245-L281","documentation":"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.","triggerScenarios":"Thrown at src/openhuman/agent/tools/todo.rs:263 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass approvalMode as a string (\"required\"/\"not_required\") or null"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}