You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(prompts): line-number stripping warning missing from search_replace, edit_file, and read_file tool descriptions #716
Models that use read_file output as input to search_replace or edit_file fail with exact-match errors because the line-number prefixes (137 | content) produced by read_file are copied verbatim into old_string. The tool descriptions for these two tools have no warning about this, unlike the recently patched apply_diff (PR #641).
Context (who is affected and when)
Affects any model/provider that copies read_file output directly into search_replace or edit_file — observed with Gemini but likely reproducible with others. Occurs whenever a model reads a file and then attempts an edit using content from that output.
Reproduction steps
Use Zoo Code with any model that references read_file output when constructing edit calls.
Model calls read_file on a file — output is prefixed with 137 | someCode() etc.
Model calls search_replace or edit_file with old_string copied verbatim from that output (including the 137 | prefix).
Tool fails with an exact-match / Edit Unsuccessful error because the raw file contains no such prefixes.
Repeated failures eventually hit consecutiveMistakeLimit.
Expected result
Tool descriptions warn models that read_file line-number prefixes (e.g. 137 | ) are decorative and must not be included in old_string.
Actual result
search_replace.ts and edit_file.ts parameter descriptions say old_string must match file contents exactly, but give no guidance about stripping read_file prefixes. edit.ts (the native Edit tool) already has this warning at line 7 — making the omission inconsistent across sibling tools.
Variations tried
The root-cause fix would be a single upstream warning in the read_file description itself (read_file.ts:65), protecting all downstream tools without requiring each to repeat it. The actual format from addLineNumbers() in extract-text.ts:155 is ${lineNumber} | ${line} (space-padded integer + | + content).
Suggested per-tool additions:
read_file.ts: "NOTE: Line-number prefixes (e.g. 137 | ) are for reference only and do NOT exist in the raw file. Do NOT copy them into old_string, SEARCH blocks, or other edit inputs."
search_replace.tsold_string: "Do NOT include line-number prefixes (e.g. 137 | ) from read_file output — the file itself does not contain them."
Activity
myk1yt commentedon Sep 19, 2026
Claiming — opening a PR shortly.