# edit_file_tool: Fail when edit location is not unique \(\#32056\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/04716a0e4a13b332f95c2b45b63eca9791e357e6)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 04716a0e4a13b332f95c2b45b63eca9791e357e6

Requested commit: 04716a0e4a13b332f95c2b45b63eca9791e357e6

Commit: 04716a0e4a13b332f95c2b45b63eca9791e357e6

Tree: ea715eb429f8d3af6a8ba868e66917edc9ce91b4

Author: Oleksiy Syvokon

Committer: GitHub

## Message

```
edit_file_tool: Fail when edit location is not unique (#32056)

When `<old_text>` points to more than one location in a file, we used to
edit the first match, confusing the agent along the way. Now we will
return an error, asking to expand `<old_text>` selection.

Closes #ISSUE

Release Notes:

- agent: Fixed incorrect file edits when edit locations are ambiguous
```

## Parents

- [5e38915d454f424e47d9fe426bb7181055197c79](https://git.cafe/gitcafe/zed/commit/5e38915d454f424e47d9fe426bb7181055197c79?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/04716a0e4a13b332f95c2b45b63eca9791e357e6?format=markdown)
