-
-
Notifications
You must be signed in to change notification settings - Fork 69.5k
[Bug]: Edit tool parameter alias coverage incomplete - old_text, new_text, file not recognized #52164
Description
Bug type
Behavior bug (incorrect output/state without crash)
Summary
The edit tool's parameter validation in CLAUDE_PARAM_GROUPS does not cover common parameter name variants that LLMs generate. This causes repeated Missing required parameters errors even when the model provides correct values under slightly different parameter names.
Current accepted aliases:
- Path:
path,file_path - Old text:
oldText,old_string - New text:
newText,new_string
Missing aliases that LLMs commonly generate:
file(for path) — Claude models frequently use thisold_text(for oldText) — snake_case variantnew_text(for newText) — snake_case variant
Steps to reproduce
- Use any Claude model (tested with claude-opus-4-6, claude-sonnet-4-6)
- Have the model call the edit tool repeatedly across sessions
- Observe that the model sometimes generates
fileinstead ofpath, orold_textinstead ofoldText - These calls fail with
Missing required parameterseven though the values are correct
Expected behavior
The edit tool should accept file, old_text, and new_text as valid parameter aliases, similar to how it already accepts both camelCase (oldText) and snake_case (old_string) variants.
Actual behavior
[ERROR] [tools] edit failed: Missing required parameters: oldText (oldText or old_string), newText (newText or new_string). Supply correct parameters before retrying.
or:
[ERROR] [tools] edit failed: Missing required parameter: path (path or file_path). Supply correct parameters before retrying.
Root Cause Analysis
The validation logic in assertRequiredParams checks:
for (const group of groups) if (!group.keys.some((key) => {
if (!(key in record)) return false;
// ...
}))When the LLM sends old_text, it doesn't match oldText or old_string, so validation fails.
Suggested Fix
Add missing aliases to CLAUDE_PARAM_GROUPS:
edit: [
- { keys: ["path", "file_path"], label: "path (path or file_path)" },
+ { keys: ["path", "file_path", "file"], label: "path (path or file_path)" },
- { keys: ["oldText", "old_string"], label: "oldText (oldText or old_string)" },
+ { keys: ["oldText", "old_string", "old_text"], label: "oldText (oldText or old_string)" },
- { keys: ["newText", "new_string"], label: "newText (newText or new_string)" },
+ { keys: ["newText", "new_string", "new_text"], label: "newText (newText or new_string)" },
]Same aliases should be added for read and write tools' path parameter.
OpenClaw version
2026.3.2
Operating system
Windows 10
Install method
npm global
Model
anthropic/claude-opus-4-6, anthropic/claude-sonnet-4-6
Evidence
From session transcripts, the error has been recurring since March 4, 2026 across multiple sessions:
Case 1 — file alias (2026-03-21):
{"name":"edit","arguments":{"file":"C:\\Users\\PC\\Desktop\\openclaw-panel\\main.js","oldText":"...","newText":"..."}}Result: Missing required parameter: path (path or file_path)
Case 2 — old_text/new_text alias (2026-03-22):
{"name":"edit","arguments":{"file_path":"C:\\Users\\PC\\Desktop\\openclaw-panel\\main.js","old_text":"...","new_text":"..."}}Result: Missing required parameters: oldText (oldText or old_string), newText (newText or new_string)
Both cases had correct values — only the parameter names were slightly different from what the validator accepts.
Related Issues
- [Bug]: Edit tool fails everytime because of "Missing required parameters" #44203 — Same error symptom but caused by model completely omitting parameters (different root cause)
- edit tool rejects empty string newText as 'Missing required parameter' #19085 — Empty string
newTextrejected (fixed withallowEmpty: true)
Impact and severity
Frequency: Intermittent but recurring (multiple times per day across sessions)
Severity: Blocks edit operations, forces fallback to write tool (data loss risk)
Affected models: Claude Opus 4, Claude Sonnet 4 (likely affects all models)