Skip to content

Commit 7d07c53

Browse files
committed
fix(chat): Fix toolUse input is missing when parsing fails
1 parent 90dfc71 commit 7d07c53

File tree

1 file changed

+5
-0
lines changed
  • packages/core/src/codewhispererChat/controllers/chat/messenger

1 file changed

+5
-0
lines changed

packages/core/src/codewhispererChat/controllers/chat/messenger/messenger.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,11 @@ export class Messenger {
356356
throw new Error('Tool not found')
357357
}
358358
} catch (error: any) {
359+
if (error instanceof SyntaxError) {
360+
// set toolUse.input to the raw value
361+
toolUse.input = toolUseInput
362+
error.message = `Tool input has invalid JSON format: ${error.message}`
363+
}
359364
getLogger().error(
360365
`toolUseId: ${toolUse.toolUseId}, toolUseName: ${toolUse.name}, error: ${error}`
361366
)

0 commit comments

Comments
 (0)