tinyhumansai/openhuman · error

Missing 'old_string' parameter

Error message

Missing 'old_string' parameter

What it means

Guard in EditFileTool::execute_in_context: `path` was supplied but `old_string` is missing or not a string. Without the exact anchor text the replacement cannot be located; the error fires at argument parsing, before the file is read.

Source

Thrown at src/openhuman/tools/impl/filesystem/edit_file.rs:95

    ) -> anyhow::Result<ToolResult> {
        self.execute_in_context(args, context).await
    }
}

impl EditFileTool {
    async fn execute_in_context(
        &self,
        args: serde_json::Value,
        context: Option<&ToolExecutionContext>,
    ) -> anyhow::Result<ToolResult> {
        let path = args
            .get("path")
            .and_then(|v| v.as_str())
            .ok_or_else(|| anyhow::anyhow!("Missing 'path' parameter"))?;
        let old_string = args
            .get("old_string")
            .and_then(|v| v.as_str())
            .ok_or_else(|| anyhow::anyhow!("Missing 'old_string' parameter"))?;
        let new_string = args
            .get("new_string")
            .and_then(|v| v.as_str())
            .ok_or_else(|| anyhow::anyhow!("Missing 'new_string' parameter"))?;
        let replace_all = args
            .get("replace_all")
            .and_then(|v| v.as_bool())
            .unwrap_or(false);

        if old_string.is_empty() {
            return Ok(ToolResult::error("`old_string` must not be empty"));
        }
        if old_string == new_string {
            return Ok(ToolResult::error(
                "`old_string` and `new_string` are identical — nothing to do",
            ));
        }

View on GitHub (pinned to 7491200858)

Solutions

  1. Include `old_string` with the exact current text to replace
  2. Ensure old_string matches the file content exactly (whitespace included)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/tools/impl/filesystem/edit_file.rs:95 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/20b832d08fa82f7a. Report an issue: GitHub.