can1357/oh-my-pi · error · Error
Unexpected broker response ${result.op}
Error message
Unexpected broker response ${result.op} What it means
`omp ps info` sends a `{op:"describe", name}` request to the daemon broker and expects a describe reply back. This guard throws when the broker answers with any other response variant, meaning the wire contract between the CLI and the broker was violated (the request and reply ops no longer line up). It is a defensive protocol-mismatch check, not a user-facing condition caused by the daemon itself.
Source
Thrown at packages/coding-agent/src/cli/ps-cli.ts:166
}
}
// ---------------------------------------------------------------------------
// Named actions
// ---------------------------------------------------------------------------
async function actionClient(flags: PsCommandArgs["flags"]): Promise<DaemonBrokerClient> {
if (flags.global) return daemonClientForGlobal(flags.global);
return daemonClientForProject(flags.dir ?? getProjectDir());
}
async function runAction(cmd: PsCommandArgs, name: string): Promise<void> {
const client = await actionClient(cmd.flags);
try {
switch (cmd.action) {
case "info": {
const result = await client.request({ op: "describe", name });
if (result.op !== "describe") throw new Error(`Unexpected broker response ${result.op}`);
if (cmd.flags.json) {
console.log(JSON.stringify({ ...result.daemon, spec: result.spec }, null, 2));
return;
}
const daemon = result.daemon;
console.log(daemonLabel(daemon));
console.log(` command: ${formatCommand(result.spec)}`);
console.log(` cwd: ${result.spec.cwd}`);
if (!TERMINAL_STATES[daemon.state])
console.log(` uptime: ${formatDuration(Date.now() - daemon.startedAt)}`);
if (daemon.exitReason) console.log(` exit: ${daemon.exitReason}`);
console.log(` restarts: ${daemon.restartCount} (policy: ${result.spec.restart})`);
console.log(
` pty: ${result.spec.pty} persist: ${result.spec.persist} detached: ${result.spec.detached} owner: ${daemon.owner ?? "-"}`,
);
return;
}
case "logs":View on GitHub (pinned to 9690622007)
Solutions
- Restart the broker (or reboot the machine / kill the stale broker process) so the broker and CLI come from the same omp version.
- Reinstall/upgrade omp so the CLI and the daemon runtime match (`bun install` or the install script for both).
- Run with `--json` after the versions match; if it still reproduces, capture the actual `result.op` value and file a bug against the launch/protocol code.
Example fix
// before
const result = await client.request({ op: "describe", name });
if (result.op !== "describe") throw new Error(`Unexpected broker response ${result.op}`);
// after
const result = await client.request({ op: "describe", name });
if (result.op === "error") throw new Error(`Broker error: ${result.message}`);
if (result.op !== "describe") throw new Error(`Unexpected broker response ${result.op}`); Defensive patterns
Strategy: type-guard
Validate before calling
const brokerAlive = await Bun.file(scope.runtimeDir + "/broker.json").exists().catch(() => false);
if (!brokerAlive) throw new Error("Broker not running; it will be revived on next command"); Type guard
function isDescribeResponse(r: { op: string }): r is { op: "describe"; daemon: DaemonSnapshot; spec: DaemonSpec } {
return r.op === "describe";
} Try / catch
try {
const result = await client.request({ op: "describe", name });
if (!isDescribeResponse(result)) throw new Error(`Unexpected broker response ${result.op}`);
} catch (err) {
console.error(chalk.red(err instanceof Error ? err.message : String(err)));
} Prevention
- Keep CLI and broker on the same omp version; restart stale brokers after upgrading.
- Narrow responses with a discriminated-union type guard instead of ad-hoc string comparisons.
- Map known error ops (e.g. not-found) to friendly messages before the generic guard.
When it happens
Trigger: Calling `runAction` with action "info" while `client.request({op:"describe", name})` returns a response whose `op` field is anything other than "describe" — e.g. an error-shaped response, a `not-found` variant, or a broker from a different omp version replying with an older/newer message shape.
Common situations: Running an `omp` CLI binary that is older or newer than the broker process it connects to (version skew after an upgrade while a long-lived broker from the previous version is still running); a proxy/wrapper intercepting the broker socket; a broker bug replying with an error op instead of describe.
Related errors
- Unexpected broker response ${first.op}
- Unexpected broker response ${next.op}
- Unexpected broker response ${result.op}
- Unexpected response ${result.op}
- blob daemon ${input} responded ${response.status}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/c6aa01e641a9299d.
Report an issue: GitHub.