openclaw - 💡(How to fix) Fix edit tool shows false positive error when oldText match fails after file was already fixed [1 participants]

Official PRs (…)
ON THIS PAGE

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#59868Fetched 2026-04-08 02:39:34
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Error Message

Error: Tool did not complete. Edit: in ~/.openclaw/openclaw.json (398 chars) failed

Root Cause

This causes confusion because:

  1. The file is actually correct (verified by json.load())
  2. The error message persists and looks like a failure even when nothing is wrong
  3. Users cannot distinguish between "edit never succeeded" vs "edit succeeded but error was cached/shown incorrectly"

Code Example

Error: Tool did not complete. Edit: in ~/.openclaw/openclaw.json (398 chars) failed
RAW_BUFFERClick to expand / collapse

Problem

When using the edit tool, if the oldText parameter does not match (e.g., due to minor whitespace differences or encoding), the tool returns an error like:

Error: Tool did not complete. Edit: in ~/.openclaw/openclaw.json (398 chars) failed

However, if the user then manually corrects the file (e.g., using python3 to write JSON), the file becomes correct, but the error message may still appear in subsequent interactions as if the edit had never succeeded.

Impact

This causes confusion because:

  1. The file is actually correct (verified by json.load())
  2. The error message persists and looks like a failure even when nothing is wrong
  3. Users cannot distinguish between "edit never succeeded" vs "edit succeeded but error was cached/shown incorrectly"

Suggested Solution

  1. After a successful file write (e.g., confirmed by json.load validation), clear any cached error state
  2. Or: Add a configuration option to enable/disable detailed error messages
  3. Or: Distinguish between "permanent failure" vs "transient display artifact"

Environment

  • OpenClaw version: 2026.3.11
  • Channel: qqbot
  • Model: MiniMax-M2.7-highspeed

Reproduction Steps

  1. Use edit tool with an oldText that does not match exactly (whitespace difference)
  2. Tool reports error
  3. Manually fix the file externally (e.g., python3 script)
  4. File is now correct (verified with json.load)
  5. Error message still appears in conversation as if file is still broken

extent analysis

TL;DR

Clearing any cached error state after a successful file write may resolve the issue of persistent error messages.

Guidance

  • Verify that the file is indeed correct after manual correction using json.load() to ensure the issue is not with the file itself.
  • Consider implementing a mechanism to distinguish between "permanent failure" and "transient display artifact" to improve user experience.
  • After a successful file write, attempt to clear any cached error state to prevent the error message from persisting.
  • Review the OpenClaw configuration options to see if there's an existing setting that can be adjusted to achieve the desired behavior.

Example

No specific code snippet can be provided without more context on the OpenClaw API, but a hypothetical example might involve calling a clearErrorState() method after validating the file with json.load().

Notes

The solution may depend on the internal implementation of the OpenClaw tool and its error handling mechanisms, which are not fully described in the issue.

Recommendation

Apply workaround: Clear any cached error state after a successful file write, as this directly addresses the reported issue of persistent error messages without requiring changes to the underlying tool or configuration.

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…

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 edit tool shows false positive error when oldText match fails after file was already fixed [1 participants]