{"record":{"id":"3fd3f40fcc64c8c8","repo":"ComposioHQ/composio","slug":"failed-to-parse-tool-router-session-files-mount-do","errorCode":null,"errorMessage":"Failed to parse tool router session files mount download options","messagePattern":"Failed to parse tool router session files mount download options","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/models/ToolRouterSessionFileMount.ts","lineNumber":318,"sourceCode":"   *\n   * @example\n   * ```typescript\n   * // Download from a custom mount\n   * await session.experimental.files.download('/exports/data.json', {\n   *   mountId: 'custom-mount',\n   * });\n   * ```\n   */\n  async download(\n    filePath: string,\n    options?: ToolRouterSessionFilesMountDownloadOptions\n  ): Promise<RemoteFile> {\n    const downloadOptions = ToolRouterSessionFilesMountDownloadOptionsSchema.safeParse(\n      options ?? {}\n    );\n\n    if (!downloadOptions.success) {\n      throw new ValidationError(\n        'Failed to parse tool router session files mount download options',\n        {\n          cause: downloadOptions.error,\n        }\n      );\n    }\n\n    const createDownloadURLResponse = await this.client.toolRouter.session.files.createDownloadURL(\n      downloadOptions.data.mountId,\n      {\n        session_id: this.sessionId,\n        mount_relative_path: filePath,\n      }\n    );\n\n    const downloadURLData =\n      typeof createDownloadURLResponse === 'object' && 'body' in createDownloadURLResponse\n        ? (createDownloadURLResponse as { body: unknown }).body","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/models/ToolRouterSessionFileMount.ts#L300-L336","documentation":"The download() method validates its options argument with ToolRouterSessionFilesMountDownloadOptionsSchema before issuing any request. If options do not match (e.g. mountId missing/invalid), a ValidationError with the Zod issues as cause is thrown. This fails fast before any network activity.","triggerScenarios":"Calling mount.download(remotePath, { mountId: ... }) with a missing, undefined, or non-string mountId, or otherwise schema-invalid options object.","commonSituations":"Reusing an options object built for a different mount, destructuring that drops mountId, or passing the session id instead of the mount id.","solutions":["Pass a valid mountId string in the download options","Verify the mount id comes from the file mount creation/listing, not the session id","Read error.cause (ZodError) issues to find the offending field"],"exampleFix":"// before\nawait mount.download('/data/file.csv', { mountId: sessionId });\n// after\nawait mount.download('/data/file.csv', { mountId: mountId });","handlingStrategy":"validation","validationCode":"const ok = typeof opts?.mountId === 'string' && opts.mountId.length > 0;\nif (!ok) throw new Error('mountId required');\nawait mount.download(path, opts);","typeGuard":"const isDownloadOpts = (o: unknown): o is { mountId: string } =>\n  typeof o === 'object' && o !== null && typeof (o as any).mountId === 'string';","tryCatchPattern":"try { await mount.download(path, opts); } catch (e) { if (e instanceof ValidationError) console.error(e.cause?.issues); throw e; }","preventionTips":["Centralize mount options in one typed constant reused across upload/download/delete"],"tags":["validation","zod","download","file-mount","typescript"],"backgroundTag":"schema-validation-failed","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}