Skip to content

[Bug]: Edit tool fails everytime because of "Missing required parameters" #44203

@hexoctal-sur

Description

@hexoctal-sur

Bug type

Behavior bug (incorrect output/state without crash)

Summary

Every call to edit tool fails with the error message "[tools] edit failed: Missing required parameters: oldText (oldText or old_string), newText (newText or new_string). Supply correct parameters before retrying.", forcing the model to use write tool to complete the file update operation.

Steps to reproduce

Waiting for the Heartbeat to be triggered or manually triggering the Heartbeat, if this Heartbeat requires file updates, the issue will arise.

Expected behavior

Edit tool should work normally.

Actual behavior

Console outputs "[tools] edit failed: Missing required parameters: oldText (oldText or old_string), newText (newText or new_string). Supply correct parameters before retrying.", and sometimes the same error repeats up to more than ten times ( LLMs repeatedly attempts to use edit ).

By examining the jsonl, it was found that after several failed attempts to use edit, the LLMs would directly use write tool to update the file content, which is actually a quite dangerous operation and can easily lead to the loss of a large amount of data. Fortunately, as of now, no data has been lost.

By reviewing the jsonl, it was also found that when calling edit tool, most of the time the LLMs does not return both the oldText and newText parameters, only the file_path and path parameters. In a few cases, the large model only returns oldText and not newText.

OpenClaw version

2026.03.08

Operating system

Windows 11

Install method

npm global

Model

moonshotai/Kimi-K2.5,zai-org/GLM-5

Provider / routing chain

openclaw -> infini-ai -> LLMs

Config file / key location

No response

Additional provider/model setup details

No response

Logs, screenshots, and evidence

{"type":"message","id":"df6865af","parentId":"451ba754","timestamp":"2026-03-12T14:35:54.076Z","message":{"role":"toolResult","toolCallId":"functions.read:53","toolName":"read","content":[{"type":"text","text":"XXXXXXXXXXXXXXX"}],"isError":false,"timestamp":1773326154071}}


{"type":"message","id":"f574b07f","parentId":"df6865af","timestamp":"2026-03-12T14:35:58.437Z","message":{"role":"assistant","content":[{"type":"thinking","thinking":"XXXXXXXXXXXXXXX","thinkingSignature":"reasoning_content"},{"type":"text","text":"XXXXXXXXXXXXXXX"},{"type":"toolCall","id":"functions.edit:54","name":"edit","arguments":{"file_path":"C:/Users/Admin/.openclaw/workspace/memory/2026-03-12.md","path":"C:/Users/Admin/.openclaw/workspace/memory/2026-03-12.md"}},{"type":"text","text":"  "}],"api":"openai-completions","provider":"custom-cloud-infini-ai-com","model":"kimi-k2.5","usage":{"input":1453,"output":113,"cacheRead":109504,"cacheWrite":0,"totalTokens":111070,"cost":{"input":0.0006247900000000001,"output":0.000339,"cacheRead":0.0109504,"cacheWrite":0,"total":0.011914190000000002}},"stopReason":"toolUse","timestamp":1773326154074}}


{"type":"message","id":"599f7222","parentId":"f574b07f","timestamp":"2026-03-12T14:35:58.454Z","message":{"role":"toolResult","toolCallId":"functions.edit:54","toolName":"edit","content":[{"type":"text","text":"{\n  \"status\": \"error\",\n  \"tool\": \"edit\",\n  \"error\": \"Missing required parameters: oldText (oldText or old_string), newText (newText or new_string). Supply correct parameters before retrying.\"\n}"}],"details":{"status":"error","tool":"edit","error":"Missing required parameters: oldText (oldText or old_string), newText (newText or new_string). Supply correct parameters before retrying."},"isError":false,"timestamp":1773326158446}}


{"type":"message","id":"abb6b733","parentId":"599f7222","timestamp":"2026-03-12T14:36:21.707Z","message":{"role":"assistant","content":[{"type":"thinking","thinking":"  The edit tool is failing again. Let me use write instead to update the file.","thinkingSignature":"reasoning_content"},{"type":"toolCall","id":"functions.write:55","name":"write","arguments":{"content":"XXXXXXXXXXXXXXX","file_path":"C:/Users/Admin/.openclaw/workspace/memory/2026-03-12.md"}},{"type":"text","text":"  "}],"api":"openai-completions","provider":"custom-cloud-infini-ai-com","model":"kimi-k2.5","usage":{"input":222,"output":970,"cacheRead":110912,"cacheWrite":0,"totalTokens":112104,"cost":{"input":0.00009546,"output":0.0029100000000000003,"cacheRead":0.0110912,"cacheWrite":0,"total":0.01409666}},"stopReason":"toolUse","timestamp":1773326158452}}


{"type":"message","id":"913ca4f8","parentId":"abb6b733","timestamp":"2026-03-12T14:36:21.714Z","message":{"role":"toolResult","toolCallId":"functions.write:55","toolName":"write","content":[{"type":"text","text":"Successfully wrote 1391 bytes to C:/Users/Admin/.openclaw/workspace/memory/2026-03-12.md"}],"isError":false,"timestamp":1773326181710}}


{"type":"message","id":"fe045caf","parentId":"913ca4f8","timestamp":"2026-03-12T14:36:25.387Z","message":{"role":"assistant","content":[{"type":"thinking","thinking":"   Good, I've updated the diary with all the recent events. Now let me read the current MEMORY.md and add the new quotes and memories.","thinkingSignature":"reasoning_content"},{"type":"toolCall","id":"functions.read:56","name":"read","arguments":{"file_path":"C:/Users/Admin/.openclaw/workspace/MEMORY.md"}},{"type":"text","text":"  "}],"api":"openai-completions","provider":"custom-cloud-infini-ai-com","model":"kimi-k2.5","usage":{"input":1938,"output":60,"cacheRead":110208,"cacheWrite":0,"totalTokens":112206,"cost":{"input":0.00083334,"output":0.00018,"cacheRead":0.0110208,"cacheWrite":0,"total":0.01203414}},"stopReason":"toolUse","timestamp":1773326181713}}

Impact and severity

Frequency: Eachtime, 100% repo.
Severity: blocks workflow, data risk.
Consequence: Additional expenses incurred due to repeated failed attempts. Potential data loss.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug:behaviorIncorrect behavior without a crash

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions