-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Bug]: edit tool: confusing error on whitespace mismatch, needs better surfacing #66915
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.bugSomething isn't workingSomething isn't workingbug:behaviorIncorrect behavior without a crashIncorrect behavior without a crashclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivityMarked as stale due to inactivity
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.bugSomething isn't workingSomething isn't workingbug:behaviorIncorrect behavior without a crashIncorrect behavior without a crashclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivityMarked as stale due to inactivity
Type
Fields
Priority
None yet
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
When the
edittool'soldTextparameter doesn't match the file exactly — due to whitespace differences (trailing spaces, tabs, line ending differences) — the edit fails and OpenClaw posts an opaque user-visible notification to the chat:This is confusing for users who don't understand what the error means, and there's no clear path to recovery.
Steps to reproduce
readtooledittool with the originaloldTextObserved Behavior
The user sees:
Expected behavior
When
editfails, the error surfaced to the user should be clear and actionable — something like:Additionally, a permanent solution should allow disabling
editentirely via config, usingwriteexclusively for agents or self-hosted deployments that prioritize reliability over precise editing.Actual behavior
The user sees:
OpenClaw version
2026.4.14(observed) — likely affects all recent versionsOperating system
AlmaLinux 10.1 (self-hosted Linux)
Install method
No response
Model
Any model — the issue is tool-level, not model-level
Provider / routing chain
Any provider — the issue affects all channels (Signal, Discord, web UI)
Additional provider/model setup details
No response
Logs, screenshots, and evidence
Impact and severity
writeworkaround, which overwrites entire filesAdditional information
Workaround: Use the
writetool instead ofeditfor dynamic files. This works butwriteoverwrites the entire file rather than patching a section, which is riskier in multi-agent scenarios.Suggested fixes:
editfails — surface the actual cause clearlyeditand usewriteexclusively, eliminating the failure mode at the sourceCode pointers (for maintainers):
edittool exact-match logic in the tool implementationTEXT_NOT_FOUND,PERMISSION_DENIED, etc.)