can1357/oh-my-pi · error

ssh binary not found in PATH

Error message

ssh binary not found in PATH

What it means

`runRemoteLogin` spawns `ssh` to create the OAuth port-forward and first resolves the binary with `$which("ssh")`. When `ssh` is not present in `PATH` the tunnel cannot be created, so it throws this pre-flight dependency error instead of a confusing spawn failure.

Source

Thrown at packages/coding-agent/src/cli/auth-broker-cli.ts:394

		throw new Error(
			`No known OAuth callback port for '${provider}'. Use device-code flow on the broker host directly.`,
		);
	}
	const sshArgs = [
		"-L",
		`${port}:127.0.0.1:${port}`,
		"-o",
		"ExitOnForwardFailure=yes",
		via,
		`${APP_NAME} auth-broker login ${provider}`,
	];
	if (dryRun) {
		process.stdout.write(`ssh ${sshArgs.map(a => (a.includes(" ") ? `'${a}'` : a)).join(" ")}\n`);
		return;
	}
	const sshBin = $which("ssh");
	if (!sshBin) {
		throw new Error("ssh binary not found in PATH");
	}
	const proc = Bun.spawn({
		cmd: [sshBin, ...sshArgs],
		stdin: "inherit",
		stdout: "inherit",
		stderr: "inherit",
	});
	const exitCode = await proc.exited;
	if (exitCode !== 0) {
		throw new Error(`ssh exited with code ${exitCode}`);
	}
}

async function runLogout(flags: AuthBrokerCommandArgs["flags"]): Promise<void> {
	let providerArg = flags.provider;
	const store = await SqliteAuthCredentialStore.open(getAgentDbPath());
	try {
		if (!providerArg) {

View on GitHub (pinned to 9690622007)

Solutions

  1. Install an SSH client (`apt install openssh-client`, `brew install openssh`, etc.).
  2. Ensure `ssh` is on the `PATH` of the shell that runs the CLI (`which ssh`).
  3. Run the login from an environment with a full user `PATH`, or log in directly on the broker host.

Example fix

// before (PATH missing ssh)
PATH=/usr/local/bin omp auth-broker login --via host
// after
export PATH="$PATH:/usr/bin" && omp auth-broker login --via host
Defensive patterns

Strategy: validation

Validate before calling

import { $which } from "@oh-my-pi/pi-utils";
if (!$which("ssh")) {
  console.error("ssh not found; install openssh-client or run login on the broker host.");
  process.exit(1);
}
await runLogin({ provider, via: host });

Try / catch

try {
  await runLogin({ provider, via: host });
} catch (err) {
  if (err instanceof Error && err.message === "ssh binary not found in PATH") {
    console.error("Install ssh (openssh-client) or ensure it is on PATH, then retry.");
  } else throw err;
}

Prevention

When it happens

Trigger: Running `omp auth-broker login --via <host>` on a machine without an ssh client, with a stripped/minimal `PATH` (CI container, service manager), or where ssh lives outside `PATH`.

Common situations: Minimal Docker images without openssh-client; running under sudo/systemd that resets `PATH`; Windows/macOS shells where ssh is not installed or not on PATH.

Related errors


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