mastra-ai/mastra · error

No mount for dest: ${dest}

Error message

No mount for dest: ${dest}

What it means

Thrown by CompositeFilesystem.copyFile when the DESTINATION path does not resolve to any configured mount. The composite needs a target backend to write into; without a matching mount prefix it refuses the operation rather than silently choosing one.

Source

Thrown at packages/core/src/workspace/filesystem/composite-filesystem.ts:337

  async appendFile(path: string, content: FileContent): Promise<void> {
    const r = this.resolveMount(path);
    if (!r) throw new Error(`No mount for path: ${path}`);
    this.assertWritable(r.fs, path, 'appendFile');
    return r.fs.appendFile(r.fsPath, content);
  }

  async deleteFile(path: string, options?: RemoveOptions): Promise<void> {
    const r = this.resolveMount(path);
    if (!r) throw new Error(`No mount for path: ${path}`);
    this.assertWritable(r.fs, path, 'deleteFile');
    return r.fs.deleteFile(r.fsPath, options);
  }

  async copyFile(src: string, dest: string, options?: CopyOptions): Promise<void> {
    const srcR = this.resolveMount(src);
    const destR = this.resolveMount(dest);
    if (!srcR) throw new Error(`No mount for source: ${src}`);
    if (!destR) throw new Error(`No mount for dest: ${dest}`);
    this.assertWritable(destR.fs, dest, 'copyFile');

    // Same mount - delegate
    if (srcR.mountPath === destR.mountPath) {
      return srcR.fs.copyFile(srcR.fsPath, destR.fsPath, options);
    }

    // Cross-mount copy - read then write
    const content = await srcR.fs.readFile(srcR.fsPath);
    await destR.fs.writeFile(destR.fsPath, content, { overwrite: options?.overwrite });
  }

  async moveFile(src: string, dest: string, options?: CopyOptions): Promise<void> {
    const srcR = this.resolveMount(src);
    const destR = this.resolveMount(dest);
    if (!srcR) throw new Error(`No mount for source: ${src}`);
    if (!destR) throw new Error(`No mount for dest: ${dest}`);
    this.assertWritable(destR.fs, dest, 'moveFile');

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Correct the destination path to start with an existing mount path from cfs.mountPaths.
  2. Add the missing destination mount to the CompositeFilesystem config.
  3. Pre-check with cfs.getMountPathForPath(dest) before copying and fail fast with a clearer app-level message.

Example fix

// before
await cfs.copyFile('/local/a.txt', '/backup/a.txt'); // no '/backup' mount
// after
await cfs.copyFile('/local/a.txt', '/local/backup/a.txt');
Defensive patterns

Strategy: validation

Validate before calling

if (!cfs.getMountPathForPath(dest)) throw new Error(`Dest path '${dest}' does not match any mount: ${cfs.mountPaths.join(', ')}`);

Try / catch

try {
  await cfs.copyFile(src, dest);
} catch (e) {
  if (e instanceof Error && e.message.startsWith('No mount for dest:')) {
    throw new Error(`Unknown workspace destination '${dest}'. Available mounts: ${cfs.mountPaths.join(', ')}`);
  }
  throw e;
}

Prevention

When it happens

Trigger: composite.copyFile(src, dest) where dest's prefix matches no mount key, e.g. mounts {'/local': ...} and call copyFile('/local/a.txt', '/backup/a.txt') with no '/backup' mount.

Common situations: Adding a copy target to a new backend without mounting it; typo in the destination mount prefix; environment-specific mount configs (dest mount only exists in prod); moving files to a path meant for a default root mount that was never configured.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/696a8cab691911dd. Report an issue: GitHub.