{"record":{"id":"f7610f788ed969a8","repo":"ComposioHQ/composio","slug":"invalid-tool-execute-session-parameters","errorCode":null,"errorMessage":"Invalid tool execute session parameters","messagePattern":"Invalid tool execute session parameters","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/models/Tools.ts","lineNumber":1194,"sourceCode":"   * @param {string} toolSlug - The slug of the tool to execute\n   * @param {ToolExecuteMetaParams} body - The execution parameters\n   * @param {string} body.sessionId - The session id to execute the tool for\n   * @param {Record<string, unknown>} body.arguments - The input to pass to the tool\n   * @param {SessionExecuteMetaModifiers} modifiers - The modifiers to apply to the tool\n   * @param {Tool} tool - Optional tool schema used to resolve toolkit metadata for modifiers\n   * @returns {Promise<ToolExecuteResponse>} The response from the tool execution\n   */\n  async executeSessionTool(\n    toolSlug: string,\n    body: ToolExecuteMetaParams,\n    modifiers?: SessionExecuteMetaModifiers,\n    tool?: Tool,\n    options?: ToolRouterSessionExecuteOptions,\n    requestOptions?: ComposioRequestOptions\n  ): Promise<ToolExecuteResponse> {\n    const executeParams = ToolExecuteMetaParamsSchema.safeParse(body);\n    if (!executeParams.success) {\n      throw new ValidationError('Invalid tool execute session parameters', {\n        cause: executeParams.error,\n      });\n    }\n\n    let modifiedParams = body.arguments ?? {};\n    const toolkitSlug = tool?.toolkit?.slug ?? 'composio';\n\n    if (tool) {\n      const fileModifiedParams = await this.applyFileUploadModifiers(\n        tool,\n        {\n          toolSlug,\n          toolkitSlug,\n          params: { arguments: modifiedParams },\n        },\n        undefined,\n        requestOptions\n      );","sourceCodeStart":1176,"sourceCodeEnd":1212,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/models/Tools.ts#L1176-L1212","documentation":"ValidationError('Invalid tool execute session parameters') is thrown by executeSessionTool when body fails ToolExecuteMetaParamsSchema.safeParse. This is the session-scoped execution path (used by executeBackendSessionTool and executeToolFn); validation happens client-side before the request is sent, with the ZodError attached as cause.","triggerScenarios":"Calling executeSessionTool (directly or via a tool-router session's executeToolFn) with a body violating ToolExecuteMetaParamsSchema — e.g. arguments of the wrong type, invalid metadata fields, or unexpected keys.","commonSituations":"Session/agent flows where arguments come from an LLM tool call as a JSON string or contain invalid nested values; passing execute options in the body position; SDK upgrades tightening the meta-params schema.","solutions":["Read error.cause ZodError issues and correct the named fields/types","Ensure body.arguments is a plain object (defaults to {} when omitted, so a wrong type is the usual culprit)","Normalize LLM tool-call arguments (JSON.parse, strip unknown keys) before invoking session execution"],"exampleFix":"// before\nawait session.executeToolFn(tool, { arguments: JSON.stringify(args) });\n\n// after\nawait session.executeToolFn(tool, { arguments: args });","handlingStrategy":"validation","validationCode":"import { ToolExecuteMetaParamsSchema } from '@composio/core';\nconst ok = ToolExecuteMetaParamsSchema.safeParse(body);\nif (!ok.success) {\n  throw new Error(ok.error.issues.map(i => `${i.path}: ${i.message}`).join('; '));\n}","typeGuard":"const isPlainObject = (v: unknown): v is Record<string, unknown> =>\n  typeof v === 'object' && v !== null;","tryCatchPattern":"try {\n  await executeSessionTool(body, tool, options);\n} catch (e) {\n  if (e instanceof ValidationError && /session parameters/.test(e.message)) {\n    // normalize body per e.cause issues and retry\n  }\n}","preventionTips":["Normalize LLM tool-call arguments (JSON.parse, strip unknown keys) before session execute","Keep session metadata strongly typed","Test with representative payloads in CI"],"tags":["composio","zod","validation","session","tool-execution","typescript"],"backgroundTag":"schema-validation-failed","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}