Description
The error catch block in the write_file tool handler accesses error.msg instead of error.message, causing all non-string error details to be lost.
Root Cause
In packages/agent-runtime/src/tools/handlers/tool/write-file.ts (line 142):
.catch((error) => {
// ...
return {
tool: 'write_file' as const,
path,
error: `Error: Failed to process the write_file block. ${typeof error === 'string' ? error : error.msg}`,
}
})
Standard JavaScript Error objects have a .message property, not .msg. When processFileBlock() throws a non-string error (which is the common case), 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.
Impact
When a file write operation fails with a non-string error, the actual error details are lost. Users and logs see "undefined" instead of the real error message, making debugging difficult.
Suggested Fix
error: `Error: Failed to process the write_file block. ${typeof error === 'string' ? error : error.message}`,
Description
The error catch block in the write_file tool handler accesses
error.msginstead oferror.message, causing all non-string error details to be lost.Root Cause
In
packages/agent-runtime/src/tools/handlers/tool/write-file.ts(line 142):Standard JavaScript
Errorobjects have a.messageproperty, not.msg. WhenprocessFileBlock()throws a non-string error (which is the common case),error.msgevaluates toundefined, and the error message becomes:This is the only occurrence of
.msgin the codebase — all other error handling correctly uses.message.Impact
When a file write operation fails with a non-string error, the actual error details are lost. Users and logs see "undefined" instead of the real error message, making debugging difficult.
Suggested Fix