can1357/oh-my-pi · error
Unknown auth-broker action: ${String(_exhaustive)}
Error message
Unknown auth-broker action: ${String(_exhaustive)} What it means
The auth-broker CLI dispatches on a discriminated union of actions. The default branch is a TypeScript exhaustiveness check: `const _exhaustive: never = cmd.action` only compiles when every action is handled, and at runtime throws if an unhandled action string reaches dispatch. It is a defensive assertion against a bug in the CLI's own action parsing/extension, not user input.
Source
Thrown at packages/coding-agent/src/cli/auth-broker-cli.ts:967
case "logout":
await runLogout(cmd.flags);
return;
case "import":
await runImport(cmd.flags);
return;
case "migrate":
await runMigrate(cmd.flags);
return;
case "status":
await runStatus(cmd.flags);
return;
case "list":
await runList(cmd.flags);
return;
default: {
// Exhaustive check.
const _exhaustive: never = cmd.action;
throw new Error(`Unknown auth-broker action: ${String(_exhaustive)}`);
}
}
}
export { ACTIONS as AUTH_BROKER_ACTIONS };
// Touch `$` so Bun's tree-shaker keeps the shell helper imported (used by future verbs).
void $;
View on GitHub (pinned to 9690622007)
Solutions
- Add a `case "<action>"` branch handling the new action before the default exhaustive check.
- Rebuild the project (bun install/build) so the dispatcher and action list are from the same build.
- If you hit this as a user without modifying code, report it as a bug — it indicates an internal inconsistency.
Example fix
// before
case "list":
await runList(cmd.flags);
return;
default: { ... }
// after
case "list":
await runList(cmd.flags);
return;
case "rotate":
await runRotate(cmd.flags);
return;
default: { ... } Defensive patterns
Strategy: type-guard
Validate before calling
const KNOWN_ACTIONS = ["migrate","list",...] as const;
function isKnownAction(a: string): a is typeof KNOWN_ACTIONS[number] {
return (KNOWN_ACTIONS as readonly string[]).includes(a);
} Type guard
function isBrokerAction(a: unknown): a is AuthBrokerAction {
return typeof a === "string" && ACTIONS.includes(a as AuthBrokerAction);
} Try / catch
try {
await runAuthBrokerCommand(cmd);
} catch (err) {
if (String(err).startsWith("Unknown auth-broker action")) {
console.error(`Unsupported action "${cmd.action}". Valid: ${ACTIONS.join(", ")}`);
}
throw err;
} Prevention
- When adding an action, always add the switch case in the same commit
- Rely on the `never` exhaustiveness check — never widen the union without a case
- Run typecheck (bun check) before committing CLI changes
When it happens
Trigger: runAuthBrokerCommand receives a cmd.action value not covered by the switch — typically after adding a new action to the ACTIONS list without a corresponding case, or an internal parser bug producing an unexpected action.
Common situations: Developers extending the auth-broker CLI forget to add a switch case for the new action; stale build artifacts mixing old dispatcher with new command definitions.
Related errors
- Unknown auth-gateway action: ${String(_exhaustive)}
- Invalid issue:// URL: unexpected variant '${parsed.kind}'
- --list-details, --exec, and --exec-batch are not supported b
- positional paths cannot be combined with --search-path
- unknown file type: {value}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/6d5dee8f2d6d0ecf.
Report an issue: GitHub.