tinyhumansai/openhuman · error · anyhow::Error

Missing 'edits' array

Error message

Missing 'edits' array

What it means

Guard in ApplyPatchTool::execute_in_context: the `edits` argument is missing or not a JSON array. The edit list is the tool's core payload; parsing fails before security/path policy is applied to any edit.

Source

Thrown at src/openhuman/tools/impl/filesystem/apply_patch.rs:101

        &self,
        args: serde_json::Value,
        _options: ToolCallOptions,
        context: Option<&ToolExecutionContext>,
    ) -> anyhow::Result<ToolResult> {
        self.execute_in_context(args, context).await
    }
}

impl ApplyPatchTool {
    async fn execute_in_context(
        &self,
        args: serde_json::Value,
        context: Option<&ToolExecutionContext>,
    ) -> anyhow::Result<ToolResult> {
        let edits = args
            .get("edits")
            .and_then(|v| v.as_array())
            .ok_or_else(|| anyhow::anyhow!("Missing 'edits' array"))?;
        if edits.is_empty() {
            return Ok(ToolResult::error("`edits` array is empty"));
        }
        if edits.len() > MAX_EDITS {
            return Ok(ToolResult::error(format!(
                "Too many edits: {} (max {MAX_EDITS})",
                edits.len()
            )));
        }

        if !self.security.can_act() {
            return Ok(ToolResult::error(
                "[policy-blocked] Action blocked: autonomy is read-only",
            ));
        }
        if self.security.is_rate_limited() {
            return Ok(ToolResult::error(
                "Rate limit exceeded: too many actions in the last hour",

View on GitHub (pinned to 7491200858)

Solutions

  1. Include `edits` as an array of edit objects
  2. Ensure each edit has path, old_string and new_string fields
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/tools/impl/filesystem/apply_patch.rs:101 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/6eaa71e712779c03. Report an issue: GitHub.