can1357/oh-my-pi · error

Failed to mount ${target}${suffix}

Error message

Failed to mount ${target}${suffix}

What it means

mountRemote runs `sshfs <args> <target> <mountPath>` and throws this error when sshfs exits non-zero, appending sshfs's stderr. The failure is in the sshfs tool itself — which wraps both SSH connectivity and FUSE mounting — so causes range from auth/network issues to missing FUSE support.

Source

Thrown at packages/coding-agent/src/ssh/sshfs-mount.ts:136

	await Promise.all([ensureDir(REMOTE_DIR), ensureDir(mountPath)]);

	if (await isMounted(mountPath)) {
		if (!registered) {
			registered = true;
			postmortem.register("sshfs-cleanup", unmountAll);
		}
		mountedPaths.add(mountPath);
		return mountPath;
	}

	const target = `${buildSshTarget(host.username, host.host)}:${remotePath}`;
	const args = buildSshfsArgs(host);
	const result = await $`sshfs ${args} ${target} ${mountPath}`.nothrow();

	if (result.exitCode !== 0) {
		const detail = result.stderr.toString().trim();
		const suffix = detail ? `: ${detail}` : "";
		throw new Error(`Failed to mount ${target}${suffix}`);
	}

	mountedPaths.add(mountPath);
	return mountPath;
}

export async function unmountRemote(host: SSHConnectionTarget): Promise<boolean> {
	const mountPath = getMountPath(host);
	if (!(await isMounted(mountPath))) {
		mountedPaths.delete(mountPath);
		return false;
	}

	const success = await unmountPath(mountPath);
	if (success) {
		mountedPaths.delete(mountPath);
	}

View on GitHub (pinned to 9690622007)

Solutions

  1. Read the appended stderr detail for the specific sshfs cause
  2. Install FUSE support: Linux `apt install sshfs fuse3`; macOS install macFUSE; containers need --device /dev/fuse --cap-add SYS_ADMIN (or fusermount3 setup)
  3. Verify plain `ssh <target>` works first; fix auth/host issues before mounting
  4. Unmount stale mounts: fusermount -u <mountPath> and retry
  5. Ensure the mount point exists and is empty

Example fix

# before (in container)
$ omp ssh mount prod:/data /mnt/data   # Failed to mount: fuse device not found
# after
$ docker run --device /dev/fuse --cap-add SYS_ADMIN ...
$ sudo apt-get install -y sshfs fuse3
$ omp ssh mount prod:/data /mnt/data
Defensive patterns

Strategy: validation

Validate before calling

import { $ } from "bun";
// preflight: sshfs present, FUSE device available, target reachable
const hasSshfs = await $`which sshfs`.quiet().nothrow();
const fuseDev = await fs.stat("/dev/fuse").catch(() => null);
if (hasSshfs.exitCode !== 0 || !fuseDev) throw new Error("sshfs/FUSE unavailable: install sshfs + fuse3 (container: --device /dev/fuse)");

Try / catch

try {
  const mp = await mountRemote(host);
} catch (err) {
  if (err instanceof Error && err.message.startsWith("Failed to mount ")) {
    const detail = err.message.split(": ").slice(1).join(": ");
    if (/fusermount|fuse/i.test(detail)) console.error("FUSE not available — run privileged or install fuse3");
    if (/Permission denied|publickey/i.test(detail)) console.error("Fix ssh auth before mounting");
    await $`fusermount -u ${mountPath}`.quiet().nothrow(); // clear stale mount
  }
  throw err;
}

Prevention

When it happens

Trigger: sshfs not installed or lacking setuid/fusermount permissions, mount point already in use or nonempty, remote auth failure, OS without /dev/fuse (containers without --privileged/--device /dev/fuse).

Common situations: Running inside a Docker container/CI without FUSE access, macOS without macFUSE installed, remote host unreachable or key rejected, stale mount at the target path, sshfs not installed at all.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/00eba60d930befd5. Report an issue: GitHub.