can1357/oh-my-pi · error · Error

Scope is not addressable from this machine

Error message

Scope is not addressable from this machine

What it means

The interactive `omp ps` monitor resolves a broker client per scope via `scopeClient`, which returns `undefined` when the scope cannot be addressed — on Windows the pipe name is derived from the project directory, and for discovered scopes that directory may be unknown (`scope.projectDir === undefined` on win32). The TUI raises this error when you invoke stop/kill/restart on a row whose scope has no usable connection path from this machine.

Source

Thrown at packages/coding-agent/src/cli/ps-tui.ts:152

		});
	}

	#setStatus(text: string): void {
		this.#status = text;
		this.#statusAt = Date.now();
		this.#ui.requestRender();
	}

	// -- actions ---------------------------------------------------------------

	async #act(verb: "stop" | "kill" | "restart"): Promise<void> {
		const entry = this.#flat[this.#selected];
		if (!entry) return;
		const name = entry.row.snapshot.name;
		this.#setStatus(chalk.yellow(`${verb} ${name}…`));
		try {
			const client = await this.#client(entry.scope);
			if (!client) throw new Error("Scope is not addressable from this machine");
			const result = await client.request(
				verb === "restart"
					? { op: "restart", name }
					: { op: "stop", name, timeoutMs: verb === "kill" ? KILL_GRACE_MS : 5_000 },
			);
			if (result.op !== "restart" && result.op !== "stop") throw new Error(`Unexpected response ${result.op}`);
			this.#setStatus(
				chalk.green(
					`${verb === "restart" ? "Restarted" : verb === "kill" ? "Killed" : "Stopped"} ${daemonLabel(result.daemon)}`,
				),
			);
			void this.#refresh();
		} catch (error) {
			this.#setStatus(
				chalk.red(`${verb} ${name} failed: ${error instanceof Error ? error.message : String(error)}`),
			);
		}
	}

View on GitHub (pinned to 9690622007)

Solutions

  1. Run `omp ps` from within that project's directory (or pass `--dir <project>`) so the scope's projectDir is known and the pipe name can be derived.
  2. Ping first: the list path back-fills `projectDir` via `{op:"ping"}`; refresh the table (press `a` to toggle scopes, wait for refresh) and retry.
  3. On Windows, act on the daemon from a session in the owning project rather than the global monitor.

Example fix

// before
const client = await this.#client(entry.scope);
if (!client) throw new Error("Scope is not addressable from this machine");
// after
if (!entry.scope.projectDir && process.platform === "win32") {
  this.#setStatus(chalk.red(`Select this scope via --dir ${entry.scope.runtimeDir}; pipe name needs the project dir`));
  return;
}
const client = await this.#client(entry.scope);
if (!client) throw new Error("Scope is not addressable from this machine");
Defensive patterns

Strategy: validation

Validate before calling

const addressable = (scope: PsScope): boolean =>
  scope.projectDir !== undefined || process.platform !== "win32";
if (!addressable(entry.scope)) {
  setStatus(`Scope needs a project dir (Windows); run from the owning project or use --dir`);
  return;
}

Type guard

function isAddressableScope(scope: PsScope): boolean {
  return (scope.projectDir ?? (process.platform === "win32" ? undefined : scope.runtimeDir)) !== undefined;
}

Try / catch

try {
  const client = await this.#client(entry.scope);
  if (!client) throw new Error("Scope is not addressable from this machine");
  /* ... action ... */
} catch (error) {
  this.#setStatus(chalk.red(`${verb} ${name} failed: ${error instanceof Error ? error.message : String(error)}`));
}

Prevention

When it happens

Trigger: Pressing s/x/r on a daemon row whose scope has `projectDir === undefined` while `process.platform === "win32"`, so `scopeClient` (ps-data.ts:167) short-circuits to `undefined` and `#act` throws before any request is sent.

Common situations: On Windows, browsing with `--all` and selecting a daemon from another project's scope whose project dir could not be recovered (unreadable presence file, scope discovered only from a runtime directory); then attempting an action on it.

Related errors


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