openclaw - 💡(How to fix) Fix edit tool identical content error leads to infinite retry loop — request circuit breaker

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…

Error Message

Error: edit rejected — oldText and newText are identical. No changes needed. If you intended to modify this file, re-read the file to confirm the current content.

Root Cause

LayerIssue
DirectoldText == newText
DeepMisleading error message ("might indicate special characters")
FundamentalNo circuit breaker at tool layer, allows infinite retry

Code Example

{
  "edits": [{
    "oldText": "### Department Knowledge Base Maintenance\n\n> Based on global Wiki knowledge protocol...",
    "newText": "### Department Knowledge Base Maintenance\n\n> Based on global Wiki knowledge protocol..."
  }]
}

---

{
  "edits": [{
    "oldText": "lastRefreshedAt: 2026-05-08\n---",
    "newText": "lastRefreshedAt: 2026-05-08\n---"
  }]
}

---

Error: edit rejected — oldText and newText are identical.
No changes needed. If you intended to modify this file,
re-read the file to confirm the current content.
RAW_BUFFERClick to expand / collapse

Problem Description

When the edit tool receives identical oldText and newText, it returns:

"No changes made... The replacement produced identical content. This might indicate an issue with special characters or the text not existing as expected."

This misleading message causes Agents to interpret "no change needed" as "special character issue", leading to blind retry loops of 30+ attempts, causing:

  • Session blocking
  • Log pollution
  • Task progress completely stalled

Reproduction Cases

Case 1 (admin department, 2026-05-08 22:17~22:25)

{
  "edits": [{
    "oldText": "### Department Knowledge Base Maintenance\n\n> Based on global Wiki knowledge protocol...",
    "newText": "### Department Knowledge Base Maintenance\n\n> Based on global Wiki knowledge protocol..."
  }]
}

Failed 30+ times consecutively, session terminated by timeout.

Case 2 (quill department, 2026-05-08 23:04~23:11)

{
  "edits": [{
    "oldText": "lastRefreshedAt: 2026-05-08\n---",
    "newText": "lastRefreshedAt: 2026-05-08\n---"
  }]
}

Failed 10+ times consecutively, required manual intervention.

Root Cause Analysis

LayerIssue
DirectoldText == newText
DeepMisleading error message ("might indicate special characters")
FundamentalNo circuit breaker at tool layer, allows infinite retry

Proposed Solutions

Option A: Improve Error Message (Lightweight)

Change the message to explicit wording:

Error: edit rejected — oldText and newText are identical.
No changes needed. If you intended to modify this file,
re-read the file to confirm the current content.

Option B: Add Pre-check (Medium)

Add pre-validation to the edit tool:

  • If oldText == newText, reject immediately without file I/O
  • Return explicit INVALID_IDENTICAL error code

Option C: Circuit Breaker (Recommended)

For edit calls on the same file within the same session:

  • 1st identical content failure: normal error
  • 2nd identical content failure: warning + suggestion to stop
  • 3rd identical content failure: force-terminate session or block tool for 60 seconds

Environment

  • OpenClaw version: 2026.5.4 (325df3e)
  • Trigger scenarios: Both Docker sandbox and non-sandbox
  • Impact scope: All Agents using the edit tool

Related

  • Internal rule: wiki/rules/edit-tool-usage.md (self-imposed preventive measure)
  • Incident log: wiki/departments/admin/incident-log.md

Submitted by: Shouyi (admin) on behalf of Lianhun Sect

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 identical content error leads to infinite retry loop — request circuit breaker