From eb6d50c7bd75f42ad1cf5f39a91e2a5db8a07cfe Mon Sep 17 00:00:00 2001 From: tusharmagar Date: Mon, 30 Mar 2026 02:00:10 +0530 Subject: [PATCH] Enhance error handling in Composio tool execution. Added try-catch block to log errors and return a structured error response when executing tools fails. --- .../core/src/application/lib/builtin-tools.ts | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/apps/x/packages/core/src/application/lib/builtin-tools.ts b/apps/x/packages/core/src/application/lib/builtin-tools.ts index 6d96aaab..2b508c40 100644 --- a/apps/x/packages/core/src/application/lib/builtin-tools.ts +++ b/apps/x/packages/core/src/application/lib/builtin-tools.ts @@ -1333,12 +1333,21 @@ function registerComposioTools(): void { error: `Toolkit "${toolkitSlug}" is not connected. Please connect it in Settings > Tools Library.`, }; } - return executeComposioAction(slug, { - connected_account_id: account.id, - user_id: 'rowboat-user', - version: 'latest', - arguments: input, - }); + try { + return await executeComposioAction(slug, { + connected_account_id: account.id, + user_id: 'rowboat-user', + version: 'latest', + arguments: input, + }); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + console.error(`[Composio] Tool execution failed for ${slug}:`, message); + return { + success: false, + error: `Failed to execute ${slug}: ${message}`, + }; + } }, isAvailable: async () => { return (await isComposioConfigured()) && composioAccountsRepo.isConnected(toolkitSlug);