From 49a9347e60ec696e124edb3553cd60f133ed62da Mon Sep 17 00:00:00 2001 From: Roo Code Date: Wed, 30 Jul 2025 16:10:25 +0000 Subject: [PATCH] fix: prevent "Current ask promise was ignored" error from displaying to users - Changed synchronous throw statements to Promise.reject() in Task.ask() method - This allows .catch() handlers in writeToFileTool to properly suppress expected errors - Fixes issue #6443 where users saw error messages during file writing after diff edits - All existing tests continue to pass --- src/core/task/Task.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/task/Task.ts b/src/core/task/Task.ts index edbde32ea7..a014d0c826 100644 --- a/src/core/task/Task.ts +++ b/src/core/task/Task.ts @@ -637,14 +637,14 @@ export class Task extends EventEmitter { // saves, and only post parts of partial message instead of // whole array in new listener. this.updateClineMessage(lastMessage) - throw new Error("Current ask promise was ignored (#1)") + return Promise.reject(new Error("Current ask promise was ignored (#1)")) } else { // This is a new partial message, so add it with partial // state. askTs = Date.now() this.lastMessageTs = askTs await this.addToClineMessages({ ts: askTs, type: "ask", ask: type, text, partial, isProtected }) - throw new Error("Current ask promise was ignored (#2)") + return Promise.reject(new Error("Current ask promise was ignored (#2)")) } } else { if (isUpdatingPreviousPartial) { @@ -699,7 +699,7 @@ export class Task extends EventEmitter { // Could happen if we send multiple asks in a row i.e. with // command_output. It's important that when we know an ask could // fail, it is handled gracefully. - throw new Error("Current ask promise was ignored") + return Promise.reject(new Error("Current ask promise was ignored")) } const result = { response: this.askResponse!, text: this.askResponseText, images: this.askResponseImages }