From 8bd2a2f509ae493225392389f71bfe03a4d56cc9 Mon Sep 17 00:00:00 2001 From: zbigniew sobiecki Date: Sun, 18 Jan 2026 12:03:05 +0100 Subject: [PATCH] fix(gadgets): improve EditFile error message clarity - Changed error header to "ERROR: Search content NOT FOUND in file {path}" - Removed full file content dump from error output to reduce noise - Keeps suggestions and context when available Co-Authored-By: Claude Opus 4.5 --- src/gadgets/EditFile.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/gadgets/EditFile.ts b/src/gadgets/EditFile.ts index bc7005c3..b1cc3edf 100644 --- a/src/gadgets/EditFile.ts +++ b/src/gadgets/EditFile.ts @@ -465,7 +465,7 @@ Removed 3 lines (lines 2-4). if (matches.length === 0) { // No match found - throw with helpful suggestions const failure = getMatchFailure(content, search); - throw new Error(this.formatFailure(filePath, search, failure, content)); + throw new Error(this.formatFailure(filePath, search, failure)); } // Store original content for before/after display @@ -713,12 +713,9 @@ Removed 3 lines (lines 2-4). }>; nearbyContext: string; }, - fileContent: string, ): string { const lines: string[] = [ - `path=${filePath} status=failed`, - '', - `Error: ${failure.reason}`, + `ERROR: Search content NOT FOUND in file ${filePath}`, '', 'SEARCH CONTENT:', '```', @@ -744,8 +741,6 @@ Removed 3 lines (lines 2-4). } } - lines.push('', 'CURRENT FILE CONTENT:', '```', fileContent, '```'); - return lines.join('\n'); }