{"record":{"id":"0d71a7a1cad517bd","repo":"ComposioHQ/composio","slug":"failed-to-execute-local-tool-context-finalslug","errorCode":null,"errorMessage":"Failed to execute local tool ${context.finalSlug}: ${toErrorMessage(error)}","messagePattern":"Failed to execute local tool (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ts/packages/cli-local-tools/src/runtime.ts","lineNumber":290,"sourceCode":"\nexport const executeLocalTool = async (\n  execution: LocalToolExecution,\n  input: Record<string, unknown>,\n  context: LocalExecutionContext\n): Promise<LocalExecutionResult> => {\n  try {\n    if (execution.kind === 'native') {\n      return await execution.execute(input, context);\n    }\n    if (execution.kind === 'command') {\n      return await runLocalCommand(execution, input, context);\n    }\n    if (execution.kind === 'mcp') {\n      return await runLocalMcpTool(execution, input);\n    }\n    return await runLocalFfiTool(execution, input, context);\n  } catch (error) {\n    throw new Error(`Failed to execute local tool ${context.finalSlug}: ${toErrorMessage(error)}`, {\n      cause: error,\n    });\n  }\n};\n","sourceCodeStart":272,"sourceCodeEnd":295,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/cli-local-tools/src/runtime.ts#L272-L295","documentation":"A catch-all wrapper around every local tool execution path (command, MCP, FFI). Any underlying error — argument failures, spawn errors, non-zero exits, FFI load failures — is rethrown with the tool slug prefixed and the original error attached as cause. Seeing this error means looking at the message suffix (and cause) for the real failure.","triggerScenarios":"Any exception thrown inside runLocalCommandTool/runLocalMcpTool/runLocalFfiTool during executeLocalTool; the cause chain contains errors 242–245 or spawn errors like ENOENT.","commonSituations":"Generic failure surfacing when a local tool breaks for any reason; often wraps ENOENT when the command binary is not on PATH.","solutions":["Inspect the message suffix and error.cause for the root error","Fix the underlying cause (missing binary, permissions, bad args)","Catch this error and log error.cause for actionable diagnostics"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await executeLocalTool(slug, args, ctx); } catch (e) { const root = (e as Error & { cause?: unknown }).cause ?? e; console.error(root); }","preventionTips":["Always inspect error.cause — the wrapper hides the root error in the suffix","Log cause chains in local-tool pipelines"],"tags":["wrapper","local-tools","error-handling"],"backgroundTag":"tool-execution-failed","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}