can1357/oh-my-pi · error
Unsupported RPC session change command
Error message
Unsupported RPC session change command
What it means
handleRpcSessionChange dispatches RPC session-change commands (e.g. 'branch') via a switch. If the command's type is not one of the known session change operations, the switch falls through and the function throws 'Unsupported RPC session change command'. It is a protocol-level guard against unknown or newer command types sent to an older host.
Source
Thrown at packages/coding-agent/src/modes/rpc/rpc-mode.ts:494
const options = command.parentSession ? { parentSession: command.parentSession } : undefined;
const cancelled = !(await session.newSession(options));
if (!cancelled) subagentRegistry?.clear();
return { type: "new_session", data: { cancelled } };
}
case "switch_session": {
const cancelled = !(await session.switchSession(command.sessionPath));
if (!cancelled) subagentRegistry?.clear();
return { type: "switch_session", data: { cancelled } };
}
case "branch": {
const result = await session.branch(command.entryId);
if (!result.cancelled) subagentRegistry?.clear();
return { type: "branch", data: { text: result.selectedText, cancelled: result.cancelled } };
}
}
throw new Error("Unsupported RPC session change command");
}
function normalizeHostToolDefinitions(tools: RpcHostToolDefinition[]): RpcHostToolDefinition[] {
return tools.map((tool, index) => {
const name = typeof tool.name === "string" ? tool.name.trim() : "";
if (!name) {
throw new Error(`Host tool at index ${index} must provide a non-empty name`);
}
const description = typeof tool.description === "string" ? tool.description.trim() : "";
if (!description) {
throw new Error(`Host tool "${name}" must provide a non-empty description`);
}
if (!tool.parameters || typeof tool.parameters !== "object" || Array.isArray(tool.parameters)) {
throw new Error(`Host tool "${name}" must provide a JSON Schema object`);
}
const label = typeof tool.label === "string" && tool.label.trim() ? tool.label.trim() : name;
return {
name,View on GitHub (pinned to 9690622007)
Solutions
- Check the command name sent over RPC for typos and confirm it is one of the supported session change commands (e.g. 'branch').
- Upgrade the omp host (or client) so both sides support the command type.
- Wrap the RPC dispatch in a handler that maps unknown-command errors to a clean 'unsupported command' response for the client.
Example fix
// before
await rpc.request("session.change", { command: "braanch", entryId });
// after
await rpc.request("session.change", { command: "branch", entryId }); Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED = new Set(["branch"]);
if (!SUPPORTED.has(command.type)) throw new Error(`Unsupported session change command: ${command.type}`); Type guard
function isSessionChangeCommand(cmd: string): cmd is "branch" {
return cmd === "branch";
} Try / catch
try {
await rpc.sessionChange(command);
} catch (err) {
if (err instanceof Error && err.message === "Unsupported RPC session change command") {
// surface a clean unsupported-command response to the client
} else throw err;
} Prevention
- Keep client and host versions in sync; check feature availability before sending new command types.
- Centralize the list of valid command names in a shared constant instead of inline strings.
- Log the exact command payload when this fires to catch typos quickly.
When it happens
Trigger: Sending an RPC request whose session-change command type is misspelled, not implemented in this version, or added by a newer client than the running host, so no case in the switch matches.
Common situations: Version skew between an RPC client SDK and the omp host (client sends a new command the host doesn't know); a typo in the command name in custom tooling or scripts driving the RPC interface.
Related errors
- Replacement text is not valid UTF-8: {err}
- invalid glob `{pattern}`: {error}
- RPC chunk received before protocol negotiation
- RPC protocol v2 negotiation failed
- RPC chunk exceeded the transport limit
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/e30c8962bdc2de53.
Report an issue: GitHub.