tinyhumansai/openhuman · error · anyhow::Error

invalid patch

Error message

invalid patch: {e}

What it means

The `patch` argument passed to the task-source update tool failed serde deserialization into `TaskSourcePatch`. The schema advertises a partial object with camelCase fields, so this fires when the caller sends snake_case keys, wrong value types (e.g. a string where a boolean or number is expected), or unknown/non-patch fields — the deserializer, not a domain check, rejects it.

Solutions

  1. Send the patch object with camelCase field names exactly as declared in the tool's parameters schema
  2. Check each field's declared type (boolean/string/number) and match it
  3. Remove keys that are not part of TaskSourcePatch or that the partial schema does not accept
  4. Log the serde error text `{e}` — it names the offending field and expected type
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/integrations/task_sources/tools.rs:454 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/5869e65a66e3f259. Report an issue: GitHub.

Appendix: source

Thrown at src/openhuman/integrations/task_sources/tools.rs:454

                "patch": { "type": "object", "description": "Partial TaskSourcePatch (camelCase fields)." }
            },
            "required": ["id", "patch"]
        })
    }

    fn permission_level(&self) -> PermissionLevel {
        PermissionLevel::Write
    }

    async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {
        log::debug!("[tool][task_sources] update invoked");
        let id = read_required_str(&args, "id")?;
        let patch_val = args
            .get("patch")
            .cloned()
            .ok_or_else(|| anyhow::anyhow!("missing required object argument `patch`"))?;
        let patch: TaskSourcePatch =
            serde_json::from_value(patch_val).map_err(|e| anyhow::anyhow!("invalid patch: {e}"))?;
        emit!(
            ops::update(&self.config, &id, patch).await,
            "task_source_update"
        )
    }
}

/// Delete a task source and its ingested history. **Destructive** —
/// default-OFF.
pub struct TaskSourceRemoveTool {
    config: Arc<Config>,
}

impl TaskSourceRemoveTool {
    pub fn new(config: Arc<Config>) -> Self {
        Self { config }
    }
}

View on GitHub (pinned to 7491200858)