file_editing_safeTier 1 · 70% confidence

content-file-editing-safe-when-editing-a-file-using-the-edit-file-tool-incor-ea0eecf9

agent: content

When does this happen?

IF When editing a file using the edit_file tool, incorrect edits can corrupt the file.

How others solved it

THEN Always set dryRun: true first to preview changes. Review the returned diff and match information before applying the same edits with dryRun: false. This ensures edits are correct and reduces risk of unintended modifications.

{
  "method": "tools/call",
  "params": {
    "name": "edit_file",
    "arguments": {
      "path": "example.txt",
      "edits": [{"oldText": "old content", "newText": "new content"}],
      "dryRun": true
    }
  }
}

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics