tinyhumansai/openhuman · error · anyhow::Error
edit[{i}]: missing `old_string`
Error message
edit[{i}]: missing `old_string` What it means
Guard while parsing apply_patch edits: edit[{i}] has a `path` but no string `old_string`, so the text to replace is unknown. The tool is an exact-match replacer and cannot proceed without the anchor text.
Source
Thrown at src/openhuman/tools/impl/filesystem/apply_patch.rs:140
if !self.security.record_action() {
return Ok(ToolResult::error(
"Rate limit exceeded: action budget exhausted",
));
}
let path_policy = super::security_for_tool_context(&self.security, context, "apply_patch");
// Parse + group edits by file.
let mut parsed: Vec<ParsedEdit> = Vec::with_capacity(edits.len());
for (i, raw) in edits.iter().enumerate() {
let path = raw
.get("path")
.and_then(|v| v.as_str())
.ok_or_else(|| anyhow::anyhow!("edit[{i}]: missing `path`"))?;
let old_string = raw
.get("old_string")
.and_then(|v| v.as_str())
.ok_or_else(|| anyhow::anyhow!("edit[{i}]: missing `old_string`"))?;
let new_string = raw
.get("new_string")
.and_then(|v| v.as_str())
.ok_or_else(|| anyhow::anyhow!("edit[{i}]: missing `new_string`"))?;
let replace_all = raw
.get("replace_all")
.and_then(|v| v.as_bool())
.unwrap_or(false);
if old_string.is_empty() {
return Ok(ToolResult::error(format!(
"edit[{i}]: `old_string` must not be empty"
)));
}
if !path_policy.is_path_string_allowed(path) {
return Ok(ToolResult::error(format!(
"edit[{i}]: path not allowed: {path}"
)));View on GitHub (pinned to 7491200858)
Solutions
- Add `old_string` with the exact current text to edit[{i}]
- Make old_string unique enough to match once
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/openhuman/tools/impl/filesystem/apply_patch.rs:140 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/e079cc8b0143f3b0.
Report an issue: GitHub.