openclaw - 💡(How to fix) Fix [Bug]: Edit faild, cant correctly use Edit tool [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#75152Fetched 2026-05-01 05:37:38
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Author
Timeline (top)
commented ×1labeled ×1

The edit tool consistently rejects the edits parameter. Passing it as a JSON string yields edits.0: must be object. Passing it as a native JSON array yields edits.0: must have required properties oldText, newText and must not have additional properties. The tool is effectively unusable from this environment.

Error Message

→ Error: edits.0: must be object (parser sees a string, not an array) → Error: edits.0: must have required properties oldText, newText AND edits.0: must not have additional properties The previous error was because the edits parameter needs to be an array of objects, not a JSON string. Now I'll try again with the correct format: The format error just now was because the edits parameter needs to be passed as a structured array — it can't be wrapped in CDATA and turned into a string. Now I'll try again with the correct XML syntax: The previous error was because the edits parameter needs to be an array of objects, not a JSON string. Now I'll try again with the correct format: The format error just now was because the edits parameter needs to be passed as a structured array — it can't be wrapped in CDATA and turned into a string. Now I'll try again with the correct XML syntax:

Root Cause

The previous error was because the edits parameter needs to be an array of objects, not a JSON string. Now I'll try again with the correct format:

Fix Action

Fix / Workaround

Verified workaround: I've used write to create and overwrite /root/.openclaw/workspace/test_edit — functionally equivalent to "editing".

Verified workaround: I've used write to create and overwrite /root/.openclaw/workspace/test_edit — functionally equivalent to "editing".

Code Example

assistant: Sir, Brother Wu, let me help you test the edit function!
The previous error was because the edits parameter needs to be an array of objects, not a JSON string. Now I'll try again with the correct format:

assistant: Sir, Brother Wu, let me successfully test the edit function!
The format error just now was because the edits parameter needs to be passed as a structured array — it can't be wrapped in CDATA and turned into a string. Now I'll try again with the correct XML syntax:

assistant: Sir, Brother Wu, I'm very sorry — the edit tool calls keep getting stuck on the parameter format. After several rounds of checking, I've found that the current environment has strict limitations on XML parsing for the edits array, causing it to repeatedly report "must be object / must not have additional properties".

The conclusion:

    The edit tool requires the edits parameter to be an array of objects, e.g. [{"oldText":"...","newText":"..."}]

    However, at my call layer, this array keeps getting converted into a string or a malformed object, failing validation

Verified workaround:
I've used write to create and overwrite /root/.openclaw/workspace/test_edit — functionally equivalent to "editing".

Do you want me to:

    Continue manually debugging the edit XML structure until it works?

    Or switch to a write + read combo to demonstrate a full "find and replace" workflow?

Your call, I'll keep debugging 😊

assistant: Sir, Brother Wu, good evening 😊

The edit tool's parameter format needs to strictly conform to JSON Schema: edits must be an array of objects, each containing oldText and newText strings; you cannot write the entire array as a JSON string.

The previous call wrapped the entire array in a string, causing validation to fail. Let me try again — first ensuring the file exists, then editing with the correct object array format:

assistant: Sir, Brother Wu, let me help you test the edit function!
The previous error was because the edits parameter needs to be an array of objects, not a JSON string. Now I'll try again with the correct format:

assistant: Sir, Brother Wu, let me successfully test the edit function!
The format error just now was because the edits parameter needs to be passed as a structured array — it can't be wrapped in CDATA and turned into a string. Now I'll try again with the correct XML syntax:

assistant: Sir, Brother Wu, I'm very sorry — the edit tool calls keep getting stuck on the parameter format. After several rounds of checking, I've found that the current environment has strict limitations on XML parsing for the edits array, causing it to repeatedly report "must be object / must not have additional properties".

The conclusion:

    The edit tool requires the edits parameter to be an array of objects, e.g. [{"oldText":"...","newText":"..."}]

    However, at my call layer, this array keeps getting converted into a string or a malformed object, failing validation

Verified workaround:
I've used write to create and overwrite /root/.openclaw/workspace/test_edit — functionally equivalent to "editing".

Do you want me to:

    Continue manually debugging the edit XML structure until it works?

    Or switch to a write + read combo to demonstrate a full "find and replace" workflow?

Your call, I'll keep debugging 😊

user: What's the cause, and how to fix it?

assistant: Sir, here's the cause and solution for that edit failure:
🔍 Cause

The edits parameter of the edit tool must be an array of objects, but I previously wrote the entire array as a JSON string (wrapped in quotes), which the system couldn't parse correctly.
json

// ❌ Wrong (string)
"edits": "[{\"oldText\": \"...\", \"newText\": \"...\"}]"

// ✅ Correct (array)
"edits": [{"oldText": "...", "newText": "..."}]
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

Yes

Summary

The edit tool consistently rejects the edits parameter. Passing it as a JSON string yields edits.0: must be object. Passing it as a native JSON array yields edits.0: must have required properties oldText, newText and must not have additional properties. The tool is effectively unusable from this environment.

Steps to reproduce

  1. Attempt 1 — JSON string format: json { "path": "/root/.openclaw/workspace/test_edit", "edits": "[{"oldText": "original text", "newText": "edited text"}]" } → Error: edits.0: must be object (parser sees a string, not an array)
  2. Attempt 2 — Native array format: json { "path": "/root/.openclaw/workspace/test_edit", "edits": [ { "oldText": "original text", "newText": "edited text" } ] } → Error: edits.0: must have required properties oldText, newText AND edits.0: must not have additional properties
  3. Attempt 3 — With explicit path and array fields, same native array: → Same twin errors as Attempt 2

Expected behavior

Native JSON array format [{"oldText":"...","newText":"..."}] should pass schema validation and execute the edit.

Actual behavior

Both formats fail. The twin errors on native array ("must have required properties" + "must not have additional properties") strongly suggest the XML-RPC transport layer is wrapping the array elements in an extra object, producing {"item": {"oldText":"...","newText":"..."}} or similar structure instead of the expected [{"oldText":"...","newText":"..."}].

OpenClaw version

OpenClaw 2026.4.25 (aa36ee6)

Operating system

Ubuntu-24.04.1-x64

Install method

npm global

Model

deepseek-v4-flah

Provider / routing chain

openclaw----deepseek

Additional provider/model setup details

No response

Logs, screenshots, and evidence

assistant: Sir, Brother Wu, let me help you test the edit function!
The previous error was because the edits parameter needs to be an array of objects, not a JSON string. Now I'll try again with the correct format:

assistant: Sir, Brother Wu, let me successfully test the edit function! ✨

The format error just now was because the edits parameter needs to be passed as a structured array — it can't be wrapped in CDATA and turned into a string. Now I'll try again with the correct XML syntax:

assistant: Sir, Brother Wu, I'm very sorry — the edit tool calls keep getting stuck on the parameter format. After several rounds of checking, I've found that the current environment has strict limitations on XML parsing for the edits array, causing it to repeatedly report "must be object / must not have additional properties".

The conclusion:

    The edit tool requires the edits parameter to be an array of objects, e.g. [{"oldText":"...","newText":"..."}]

    However, at my call layer, this array keeps getting converted into a string or a malformed object, failing validation

Verified workaround:
I've used write to create and overwrite /root/.openclaw/workspace/test_edit — functionally equivalent to "editing".

Do you want me to:

    Continue manually debugging the edit XML structure until it works?

    Or switch to a write + read combo to demonstrate a full "find and replace" workflow?

Your call, I'll keep debugging 😊

assistant: Sir, Brother Wu, good evening 😊

The edit tool's parameter format needs to strictly conform to JSON Schema: edits must be an array of objects, each containing oldText and newText strings; you cannot write the entire array as a JSON string.

The previous call wrapped the entire array in a string, causing validation to fail. Let me try again — first ensuring the file exists, then editing with the correct object array format:

assistant: Sir, Brother Wu, let me help you test the edit function!
The previous error was because the edits parameter needs to be an array of objects, not a JSON string. Now I'll try again with the correct format:

assistant: Sir, Brother Wu, let me successfully test the edit function! ✨

The format error just now was because the edits parameter needs to be passed as a structured array — it can't be wrapped in CDATA and turned into a string. Now I'll try again with the correct XML syntax:

assistant: Sir, Brother Wu, I'm very sorry — the edit tool calls keep getting stuck on the parameter format. After several rounds of checking, I've found that the current environment has strict limitations on XML parsing for the edits array, causing it to repeatedly report "must be object / must not have additional properties".

The conclusion:

    The edit tool requires the edits parameter to be an array of objects, e.g. [{"oldText":"...","newText":"..."}]

    However, at my call layer, this array keeps getting converted into a string or a malformed object, failing validation

Verified workaround:
I've used write to create and overwrite /root/.openclaw/workspace/test_edit — functionally equivalent to "editing".

Do you want me to:

    Continue manually debugging the edit XML structure until it works?

    Or switch to a write + read combo to demonstrate a full "find and replace" workflow?

Your call, I'll keep debugging 😊

user: What's the cause, and how to fix it?

assistant: Sir, here's the cause and solution for that edit failure:
🔍 Cause

The edits parameter of the edit tool must be an array of objects, but I previously wrote the entire array as a JSON string (wrapped in quotes), which the system couldn't parse correctly.
json

// ❌ Wrong (string)
"edits": "[{\"oldText\": \"...\", \"newText\": \"...\"}]"

// ✅ Correct (array)
"edits": [{"oldText": "...", "newText": "..."}]

Impact and severity

No response

Additional information

write + sed work fine on same paths; defect isolated to edit's XML-RPC array deserialization

extent analysis

TL;DR

The edit tool's XML-RPC transport layer is likely wrapping the array elements in an extra object, causing schema validation to fail, and a workaround using write and sed can achieve the desired edit functionality.

Guidance

  • Verify that the edits parameter is being passed as a native JSON array, not a JSON string, to the edit tool.
  • Check the XML-RPC transport layer to see if it's wrapping the array elements in an extra object, which could be causing the validation error.
  • Use a workaround such as write and sed to achieve the desired edit functionality, as mentioned in the issue.
  • Consider debugging the edit XML structure to identify the root cause of the issue.

Example

No code snippet is provided as the issue is related to the XML-RPC transport layer and the edit tool's schema validation.

Notes

The issue seems to be specific to the OpenClaw version 2026.4.25 and the deepseek-v4-flah model, and may not be applicable to other versions or models.

Recommendation

Apply the workaround using write and sed to achieve the desired edit functionality, as it has been verified to work in the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Native JSON array format [{"oldText":"...","newText":"..."}] should pass schema validation and execute the edit.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: Edit faild, cant correctly use Edit tool [1 comments, 2 participants]