From 8c1ec10bd13a7228243e7d960d19ffc8d39c4d8a Mon Sep 17 00:00:00 2001 From: Javis Date: Mon, 9 Mar 2026 21:33:28 +0800 Subject: [PATCH] fix(write-file): use error.message instead of error.msg in catch block The error catch block accessed error.msg instead of error.message, causing all non-string error details to be lost. Standard JavaScript Error objects have a .message property, not .msg. When processFileBlock() throws a non-string error, error.msg evaluates to undefined, and the error message becomes: Error: Failed to process the write_file block. undefined This is the only occurrence of .msg in the codebase - all other error handling correctly uses .message. Fixes #464 --- packages/agent-runtime/src/tools/handlers/tool/write-file.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/agent-runtime/src/tools/handlers/tool/write-file.ts b/packages/agent-runtime/src/tools/handlers/tool/write-file.ts index 4aa716641d..59a57802ee 100644 --- a/packages/agent-runtime/src/tools/handlers/tool/write-file.ts +++ b/packages/agent-runtime/src/tools/handlers/tool/write-file.ts @@ -139,7 +139,7 @@ export const handleWriteFile = (async ( return { tool: 'write_file' as const, path, - error: `Error: Failed to process the write_file block. ${typeof error === 'string' ? error : error.msg}`, + error: `Error: Failed to process the write_file block. ${typeof error === 'string' ? error : error.message}`, } }) .then(async (fileProcessingResult) => ({