ComposioHQ/composio · error · Error

File system operations are not supported in this runtime (e.

Error message

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.

What it means

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.

Source

Thrown at ts/packages/core/src/models/RemoteFile.ts:151

          filename: this.filename,
          cause: new Error(`HTTP ${response.status}: ${response.statusText}`),
        }
      );
    }
    return response.blob();
  }

  /**
   * Downloads and saves the file to the local filesystem.
   * Requires a Node.js runtime with file system support (not available in Cloudflare Workers/Edge).
   *
   * @param path - Local path to save the file. If omitted, saves to the Composio temp directory using the filename from the mount path.
   * @returns The absolute path where the file was saved
   * @throws Error if file system is not supported or the save fails
   */
  async save(path?: string): Promise<string> {
    if (!platform.supportsFileSystem) {
      throw new Error(
        '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.'
      );
    }

    const content = await this.buffer();
    const homeDir = platform.homedir();
    if (!homeDir) {
      throw new Error('Cannot determine save location: home directory is not available');
    }

    const savePath =
      path ?? platform.joinPath(homeDir, COMPOSIO_DIR, TEMP_FILES_DIRECTORY_NAME, this.filename);

    const dir =
      path != null
        ? getParentDir(savePath)
        : platform.joinPath(homeDir, COMPOSIO_DIR, TEMP_FILES_DIRECTORY_NAME);

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Use buffer(), text(), or blob() and process the content in memory
  2. Stream the bytes onward (e.g. to R2/S3) instead of local disk
  3. Move save()-dependent flows to a Node.js service

Example fix

// before
await file.save('/tmp/report.pdf');
// after
const bytes = await file.buffer();
await env.BUCKET.put(file.filename, bytes);
Defensive patterns

Strategy: type-guard

Validate before calling

import { platform } from '@composio/core';
if (!platform.supportsFileSystem) throw new Error('save() unavailable; use buffer()/text()/blob()');

Type guard

const canSave = (): boolean => Boolean(platform.supportsFileSystem);

Try / catch

try { await file.save(p); } catch (e) { if (/not supported in this runtime/.test(String(e?.message))) { return file.buffer(); } throw e; }

Prevention

When it happens

Trigger: 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().

Common situations: Porting Node.js code that saved attachments to disk into a worker; calling save() in browser/edge handlers; test harnesses that emulate edge runtimes.

Related errors


AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28). Data as JSON: /api/errors/0fe05385ecffb921. Report an issue: GitHub.