can1357/oh-my-pi · error

Unknown auth-gateway action: ${String(_exhaustive)}

Error message

Unknown auth-gateway action: ${String(_exhaustive)}

What it means

runAuthGatewayCommand switches over the gateway's action union; the default branch is an exhaustiveness assertion (`const _exhaustive: never = cmd.action`) that throws at runtime if an action reaches dispatch without a handled case. Like error 901, it protects against internal CLI wiring bugs, not normal user input.

Source

Thrown at packages/coding-agent/src/cli/auth-gateway-cli.ts:405

}

export async function runAuthGatewayCommand(cmd: AuthGatewayCommandArgs): Promise<void> {
	switch (cmd.action) {
		case "serve":
			await runServe(cmd.flags);
			return;
		case "token":
			await runToken(cmd.flags);
			return;
		case "status":
			await runStatus(cmd.flags);
			return;
		case "check":
			await runCheck(cmd.flags);
			return;
		default: {
			const _exhaustive: never = cmd.action;
			throw new Error(`Unknown auth-gateway action: ${String(_exhaustive)}`);
		}
	}
}

/**
 * Providers whose chat endpoint expects a JSON-serialized credential blob
 * (`{ token, projectId, refreshToken, expiresAt, … }`) rather than the raw
 * access token. Mirrors `getOAuthApiKey` in `packages/ai/src/registry/oauth`.
 */
const STRUCTURED_API_KEY_PROVIDERS: ReadonlySet<string> = new Set([
	"github-copilot",
	"google-gemini-cli",
	"google-antigravity",
]);

/**
 * Provider API types that strict-mode chat probes intentionally skip:
 * - `bedrock-converse-stream` resolves credentials from the AWS env/profile, not the broker bearer.

View on GitHub (pinned to 9690622007)

Solutions

  1. Add the missing `case "<action>"` branch to runAuthGatewayCommand.
  2. Rebuild/reinstall so the command parser and dispatcher match.
  3. Report as a bug if it occurs without local code changes.

Example fix

// before
case "check":
  await runCheck(cmd.flags);
  return;
default: { ... }
// after
case "check":
  await runCheck(cmd.flags);
  return;
case "token":
  await runToken(cmd.flags);
  return;
default: { ... }
Defensive patterns

Strategy: type-guard

Validate before calling

const GATEWAY_ACTIONS = ["serve","check","token"] as const;
if (!GATEWAY_ACTIONS.includes(action)) usage(1);

Type guard

function isGatewayAction(a: unknown): a is AuthGatewayAction {
  return typeof a === "string" && GATEWAY_ACTIONS.includes(a as AuthGatewayAction);
}

Try / catch

try {
  await runAuthGatewayCommand(cmd);
} catch (err) {
  if (String(err).startsWith("Unknown auth-gateway action")) {
    console.error(`Unknown action; see omp auth-gateway --help`);
  }
  throw err;
}

Prevention

When it happens

Trigger: A new auth-gateway action is added to the parser/union but the switch in runAuthGatewayCommand lacks a matching case; inconsistent builds.

Common situations: Contributor adds a `serve`-like new subcommand and forgets the case; partially applied patches or stale compiled output.

Related errors


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