fix(write-file): use error.message instead of error.msg in catch block#467
Merged
jahooma merged 1 commit intoCodebuffAI:mainfrom Mar 9, 2026
Merged
Conversation
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 CodebuffAI#464
Contributor
|
Thanks! |
reillyse
pushed a commit
to reillyse/codebuff
that referenced
this pull request
Mar 24, 2026
CodebuffAI#467) Co-authored-by: Javis <javis@JavisdeMacBook-Air.local>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a typo in the write-file tool handler where
error.msgwas used instead oferror.message.Problem
The error catch block in
packages/agent-runtime/src/tools/handlers/tool/write-file.tsaccesseserror.msginstead oferror.message, causing all non-string error details to be lost.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.
Fix
Fixes #464