{"record":{"id":"e079cc8b0143f3b0","repo":"tinyhumansai/openhuman","slug":"edit-i-missing-old-string","errorCode":null,"errorMessage":"edit[{i}]: missing `old_string`","messagePattern":"edit\\[(.+?)\\]: missing `old_string`","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/openhuman/tools/impl/filesystem/apply_patch.rs","lineNumber":140,"sourceCode":"        if !self.security.record_action() {\n            return Ok(ToolResult::error(\n                \"Rate limit exceeded: action budget exhausted\",\n            ));\n        }\n\n        let path_policy = super::security_for_tool_context(&self.security, context, \"apply_patch\");\n\n        // Parse + group edits by file.\n        let mut parsed: Vec<ParsedEdit> = Vec::with_capacity(edits.len());\n        for (i, raw) in edits.iter().enumerate() {\n            let path = raw\n                .get(\"path\")\n                .and_then(|v| v.as_str())\n                .ok_or_else(|| anyhow::anyhow!(\"edit[{i}]: missing `path`\"))?;\n            let old_string = raw\n                .get(\"old_string\")\n                .and_then(|v| v.as_str())\n                .ok_or_else(|| anyhow::anyhow!(\"edit[{i}]: missing `old_string`\"))?;\n            let new_string = raw\n                .get(\"new_string\")\n                .and_then(|v| v.as_str())\n                .ok_or_else(|| anyhow::anyhow!(\"edit[{i}]: missing `new_string`\"))?;\n            let replace_all = raw\n                .get(\"replace_all\")\n                .and_then(|v| v.as_bool())\n                .unwrap_or(false);\n\n            if old_string.is_empty() {\n                return Ok(ToolResult::error(format!(\n                    \"edit[{i}]: `old_string` must not be empty\"\n                )));\n            }\n            if !path_policy.is_path_string_allowed(path) {\n                return Ok(ToolResult::error(format!(\n                    \"edit[{i}]: path not allowed: {path}\"\n                )));","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/tools/impl/filesystem/apply_patch.rs#L122-L158","documentation":"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.","triggerScenarios":"Thrown at src/openhuman/tools/impl/filesystem/apply_patch.rs:140 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add `old_string` with the exact current text to edit[{i}]","Make old_string unique enough to match once"],"exampleFix":null,"handlingStrategy":"validation","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-14T05:17:10.506Z"}