{"record":{"id":"0fe05385ecffb921","repo":"ComposioHQ/composio","slug":"file-system-operations-are-not-supported-in-this-r","errorCode":null,"errorMessage":"File system operations are not supported in this runtime (e.g. Cloudflare Workers). Use buffer(), text(), or blob() to work with the file content in memory, or run in Node.js.","messagePattern":"File system operations are not supported in this runtime \\(e\\.g\\. Cloudflare Workers\\)\\. Use buffer\\(\\), text\\(\\), or blob\\(\\) to work with the file content in memory, or run in Node\\.js\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ts/packages/core/src/models/RemoteFile.ts","lineNumber":151,"sourceCode":"          filename: this.filename,\n          cause: new Error(`HTTP ${response.status}: ${response.statusText}`),\n        }\n      );\n    }\n    return response.blob();\n  }\n\n  /**\n   * Downloads and saves the file to the local filesystem.\n   * Requires a Node.js runtime with file system support (not available in Cloudflare Workers/Edge).\n   *\n   * @param path - Local path to save the file. If omitted, saves to the Composio temp directory using the filename from the mount path.\n   * @returns The absolute path where the file was saved\n   * @throws Error if file system is not supported or the save fails\n   */\n  async save(path?: string): Promise<string> {\n    if (!platform.supportsFileSystem) {\n      throw new Error(\n        'File system operations are not supported in this runtime (e.g. Cloudflare Workers). ' +\n          'Use buffer(), text(), or blob() to work with the file content in memory, or run in Node.js.'\n      );\n    }\n\n    const content = await this.buffer();\n    const homeDir = platform.homedir();\n    if (!homeDir) {\n      throw new Error('Cannot determine save location: home directory is not available');\n    }\n\n    const savePath =\n      path ?? platform.joinPath(homeDir, COMPOSIO_DIR, TEMP_FILES_DIRECTORY_NAME, this.filename);\n\n    const dir =\n      path != null\n        ? getParentDir(savePath)\n        : platform.joinPath(homeDir, COMPOSIO_DIR, TEMP_FILES_DIRECTORY_NAME);","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/core/src/models/RemoteFile.ts#L133-L169","documentation":"RemoteFile.save() requires filesystem access, but the current runtime's platform adapter reports supportsFileSystem === false (e.g. Cloudflare Workers/Edge). The error tells you to use in-memory accessors instead.","triggerScenarios":"Calling await remoteFile.save(path) inside a Workers/Edge runtime (or any environment where the platform capabilities object disables fs), triggering the supportsFileSystem check at the top of save().","commonSituations":"Porting Node.js code that saved attachments to disk into a worker; calling save() in browser/edge handlers; test harnesses that emulate edge runtimes.","solutions":["Use buffer(), text(), or blob() and process the content in memory","Stream the bytes onward (e.g. to R2/S3) instead of local disk","Move save()-dependent flows to a Node.js service"],"exampleFix":"// before\nawait file.save('/tmp/report.pdf');\n// after\nconst bytes = await file.buffer();\nawait env.BUCKET.put(file.filename, bytes);","handlingStrategy":"type-guard","validationCode":"import { platform } from '@composio/core';\nif (!platform.supportsFileSystem) throw new Error('save() unavailable; use buffer()/text()/blob()');","typeGuard":"const canSave = (): boolean => Boolean(platform.supportsFileSystem);","tryCatchPattern":"try { await file.save(p); } catch (e) { if (/not supported in this runtime/.test(String(e?.message))) { return file.buffer(); } throw e; }","preventionTips":["Feature-check supportsFileSystem before save()","Design worker code around in-memory content","Send bytes to object storage instead of local disk in edge runtimes"],"tags":["files","cloudflare-workers","edge-runtime","runtime-unsupported"],"backgroundTag":"unsupported-platform-api","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}