{"record":{"id":"49f76ce3e73aa4e3","repo":"tinyhumansai/openhuman","slug":"edit-i-missing-new-string","errorCode":null,"errorMessage":"edit[{i}]: missing `new_string`","messagePattern":"edit\\[(.+?)\\]: missing `new_string`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/tools/impl/filesystem/apply_patch.rs","lineNumber":144,"sourceCode":"        }\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                )));\n            }\n            parsed.push(ParsedEdit {\n                index: i,\n                path: path.to_string(),","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/tools/impl/filesystem/apply_patch.rs#L126-L162","documentation":"Guard while parsing apply_patch edits: edit[{i}] has path and old_string but no string `new_string`, so the replacement text is unknown. An empty string is valid (deletion) but must be present as a string.","triggerScenarios":"Thrown at src/openhuman/tools/impl/filesystem/apply_patch.rs:144 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add `new_string` to edit[{i}] with the replacement text","Use an explicit empty string for deletions"],"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-14T00:17:10.932Z"}