Skip to content

Commit c8fa284

Browse files
committed
fix(chat): Set valid tooluse Input when parsing fails
1 parent b1beba3 commit c8fa284

File tree

1 file changed

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

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ export class Messenger {
273273
toolUse.input = JSON.parse(toolUseInput)
274274
} catch (error: any) {
275275
getLogger().error(`JSON parse error for toolUseInput: ${toolUseInput}`)
276-
// set toolUse.input to the raw value
277-
toolUse.input = toolUseInput
276+
// set toolUse.input to be empty valid json object
277+
toolUse.input = {}
278278
error.message = `Tool input has invalid JSON format: ${error.message}`
279279
// throw it out to allow the error to be handled in the catch block
280280
throw error

0 commit comments

Comments
 (0)