earendil-works/pi · error · AuthCommandError
Unknown option -- for " ".
Error message
Unknown option --${option} for "${getAuthCommandName(kind)}". What it means
Thrown by validateAuthCommandArgs when the parsed CLI args contain a flag not in the allowlist for the given auth subcommand (unknownFlags is non-empty); the first unknown flag name is included in the message.
Solutions
- Remove the unsupported flag
- Check pi auth --help for the flags each subcommand accepts
- Fix flag spelling (e.g. --provider vs --proivder)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/coding-agent/src/cli/auth-command.ts:103 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24).
Data as JSON: /api/errors/7db7007348e6c012.
Report an issue: GitHub.
Appendix: source
Thrown at packages/coding-agent/src/cli/auth-command.ts:103
if (arg === "--json") json = true;
else if (arg === "--credentials") credentials = true;
else noRefresh = true;
continue;
}
commandArgs.push(arg);
}
return minExpiryMs === undefined
? { kind, args: commandArgs, json, credentials, noRefresh }
: { kind, args: commandArgs, json, credentials, noRefresh, minExpiryMs };
}
export function validateAuthCommandArgs(args: Args, kind: AuthCommandKind): { provider?: string; model?: string } {
const provider = args.provider?.trim() || undefined;
const model = args.model?.trim() || undefined;
if (args.unknownFlags.size > 0) {
const option = args.unknownFlags.keys().next().value;
throw new AuthCommandError(`Unknown option --${option} for "${getAuthCommandName(kind)}".`);
}
if (args.apiKey !== undefined || args.messages.length > 0 || args.fileArgs.length > 0) {
throw new AuthCommandError("Auth commands only accept --provider and --model");
}
if (kind === "check") {
if (!provider && !model) {
throw new AuthCommandError("Auth checks require --provider <provider> or --model <model>");
}
return { provider, model };
}
if (!provider && !model) {
throw new AuthCommandError("Credential printing requires --provider <provider> or --model <model>");
}
return { provider, model };
}
export function getAuthCredential(auth: AuthResult | undefined): string | undefined {
if (auth?.auth.apiKey) return auth.auth.apiKey;View on GitHub (pinned to 4af9d21d3b)