Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/anthropic/lib/tools/agent_toolset.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,8 @@ async def edit(file_path: str, old_string: str, new_string: str, replace_all: Op
target = resolve_path(ctx, file_path)
except ValueError as e:
raise ToolError(f"edit: {e}") from e
if old_string == "":
raise ToolError("edit: old_string must not be empty")
try:
# stat() before any open(): the size cap stops a multi-GB file from
# OOM'ing the runner, and is_file() rejects FIFOs/devices/dirs
Expand Down