{"record":{"id":"34a52723791f21eb","repo":"ComposioHQ/composio","slug":"composiorequestcancellederror-34a527","errorCode":null,"errorMessage":"ComposioRequestCancelledError","messagePattern":"ComposioRequestCancelledError","errorType":"exception","errorClass":"ComposioRequestCancelledError","httpStatus":null,"severity":"warning","filePath":"ts/packages/core/src/models/Tools.ts","lineNumber":273,"sourceCode":"   * @param modifier - The modifier to apply\n   * @returns The modified params\n   */\n  private async applyBeforeExecuteModifiers(\n    tool: Tool,\n    {\n      toolSlug,\n      toolkitSlug,\n      params,\n    }: {\n      toolSlug: string;\n      toolkitSlug: string;\n      params: ToolExecuteParams;\n    },\n    modifiers?: ExecuteToolModifiers,\n    requestOptions?: ComposioRequestOptions\n  ): Promise<ToolExecuteParams> {\n    if (requestOptions?.signal?.aborted) {\n      throw new ComposioRequestCancelledError();\n    }\n    let modifiedParams = await this.applyFileUploadModifiers(\n      tool,\n      { toolSlug, toolkitSlug, params },\n      modifiers?.beforeFileUpload,\n      requestOptions\n    );\n\n    // apply the before execute modifiers\n    if (modifiers?.beforeExecute) {\n      if (typeof modifiers.beforeExecute === 'function') {\n        modifiedParams = await modifiers.beforeExecute({\n          toolSlug,\n          toolkitSlug,\n          params: modifiedParams,\n        });\n        if (requestOptions?.signal?.aborted) {\n          throw new ComposioRequestCancelledError();","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/models/Tools.ts#L255-L291","documentation":"ComposioRequestCancelledError thrown by applyBeforeExecuteModifiers when the AbortSignal in requestOptions is already aborted before tool execution modifiers run. This is a cooperative-cancellation mechanism: the SDK checks the signal at each stage and stops the pipeline early.","triggerScenarios":"Calling tools.execute(...) with requestOptions.signal already aborted (e.g. an HTTP request timeout fired before the tool call started), or the signal aborting while awaiting file-upload modifiers just before this check.","commonSituations":"Server frameworks that abort request signals on client disconnect; short AbortSignal.timeout() budgets shared across multiple tool calls; racing user cancellation with tool execution.","solutions":["Check signal.aborted before invoking execute and skip/wrap the call accordingly.","Increase or remove the abort timeout if legitimate tool calls are being cancelled prematurely.","Catch ComposioRequestCancelledError and map it to your framework's cancellation response (e.g. 499) rather than a generic failure."],"exampleFix":"// before\nconst res = await tools.execute('GITHUB_STAR_REPO', params, {}, { signal: req.signal });\n\n// after\nif (req.signal.aborted) return; // client already gone\nconst res = await tools.execute('GITHUB_STAR_REPO', params, {}, { signal: req.signal });","handlingStrategy":"try-catch","validationCode":"if (opts?.signal?.aborted) return skip('cancelled before execute');\nawait tools.execute(slug, params, {}, opts);","typeGuard":"const isCancelled = (e: unknown): e is ComposioRequestCancelledError =>\n  e instanceof ComposioRequestCancelledError;","tryCatchPattern":"try {\n  await tools.execute(...);\n} catch (e) {\n  if (e instanceof ComposioRequestCancelledError) return; // clean cancel\n  throw e;\n}","preventionTips":["Check signal.aborted before starting work.","Size AbortSignal timeouts to the full tool pipeline, not just the HTTP call.","Map cancellation to 499/clean responses, not 500s."],"tags":["abort","cancellation","signal","tool-execution","typescript"],"backgroundTag":"request-aborted","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}