{"record":{"id":"ef639ffb89160064","repo":"ComposioHQ/composio","slug":"direct-execution-options-and-modifiers-cannot-be-u","errorCode":null,"errorMessage":"Direct execution options and modifiers cannot be used with a Tool Router session","messagePattern":"Direct execution options and modifiers cannot be used with a Tool Router session","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/provider/BaseProvider.ts","lineNumber":75,"sourceCode":"    body: ToolExecuteParams,\n    modifers?: ExecuteToolModifiers\n  ): Promise<ToolExecuteResponse> {\n    if (!this._globalExecuteToolFn) {\n      throw new ComposioGlobalExecuteToolFnNotSetError('executeToolFn is not set');\n    }\n\n    // For provider controlled execution, always skip version check.\n    return this._globalExecuteToolFn(toolSlug, body, modifers);\n  }\n\n  /** Reject direct-only configuration when execution is bound to a session. */\n  protected assertToolCallExecutionOptions(\n    target: ToolCallExecutionTarget,\n    options?: ExecuteToolFnOptions,\n    modifiers?: ExecuteToolModifiers\n  ): void {\n    if (typeof target !== 'string' && (options !== undefined || modifiers !== undefined)) {\n      throw new TypeError(\n        'Direct execution options and modifiers cannot be used with a Tool Router session'\n      );\n    }\n  }\n\n  /**\n   * Execute normalized provider arguments against either the direct tools API or\n   * the Tool Router session that produced the model-visible tools.\n   */\n  protected async executeToolForTarget(\n    target: ToolCallExecutionTarget,\n    toolSlug: string,\n    arguments_: Record<string, unknown>,\n    options?: ExecuteToolFnOptions,\n    modifiers?: ExecuteToolModifiers\n  ): Promise<ToolExecuteResponse> {\n    this.assertToolCallExecutionOptions(target, options, modifiers);\n","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/provider/BaseProvider.ts#L57-L93","documentation":"Composio's BaseProvider.assertToolCallExecutionOptions throws a TypeError when a caller supplies ExecuteToolFnOptions or ExecuteToolModifiers while targeting a Tool Router session instead of a string tool call ID. Options and modifiers only apply to direct execution of a single tool call. Mixing the two is an API misuse, so the SDK fails fast rather than silently ignoring the parameters.","triggerScenarios":"Calling executeToolForTarget or handleToolCalls with a non-string target (e.g. a ToolRouter/session object) while also passing `options` (timeout, abort signal, etc.) or `modifiers` (custom modifiers array) in the same call.","commonSituations":"Migrating code that executed a single tool call by ID to the Tool Router API and forgetting to strip per-call options/modifiers; copy-pasting provider-level execute calls into router-based flows; upgrading to an SDK version where this guard was added.","solutions":["Remove the options/modifiers arguments when passing a Tool Router session as the target","If you need options/modifiers, pass a string tool call ID as the target and execute the tool call directly","Check the SDK types for ExecuteToolCallExecutionTarget to confirm which target type you are using"],"exampleFix":"// before\nawait provider.executeToolForTarget(routerSession, toolCall, { timeout: 5000 }, modifiers);\n\n// after\nawait provider.executeToolForTarget(routerSession, toolCall);","handlingStrategy":"validation","validationCode":"const isDirectTarget = (t: unknown): t is string => typeof t === 'string';\nif (!isDirectTarget(target) && (options || modifiers)) {\n  throw new TypeError('Drop options/modifiers when using a Tool Router session');\n}","typeGuard":"function isToolRouterTarget(t: unknown): t is ToolRouterSession {\n  return typeof t !== 'string' && t !== null && typeof t === 'object';\n}","tryCatchPattern":"catch (e) { if (e instanceof TypeError && e.message.includes('Tool Router session')) { /* drop options/modifiers and retry */ } throw e; }","preventionTips":["Branch your code paths: router sessions vs direct tool-call IDs","Let types guide you: never pass extra args when target is not a string"],"tags":["typescript","api-misuse","tool-router","validation"],"backgroundTag":"invalid-argument-combination","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}