earendil-works/pi · error · AuthCommandError

parsed.diagnostics.map((diagnostic) =>…

Error message

parsed.diagnostics.map((diagnostic) => diagnostic.message).join("\n")

What it means

Argument validation failure in runAuthCommand: parseArgs produced diagnostics for the auth subcommand's flags (the joined messages name the exact problems, e.g. missing required values or malformed flags). The offending input is the auth command's argv.

Solutions

  1. Read the joined diagnostic messages for the exact flag problem
  2. Run the auth command with --help to see valid flags
  3. Correct the flags and rerun
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/coding-agent/src/main.ts:157 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/29ea4770f9537cce. Report an issue: GitHub.

Appendix: source

Thrown at packages/coding-agent/src/main.ts:157

	} catch (error) {
		const message = error instanceof AuthCommandError ? error.message : "Failed to parse auth command";
		console.error(chalk.red(`Error: ${message}`));
		process.exitCode = 1;
		return true;
	}
	if (!command) return false;

	const parsed = parseArgs(command.args);
	if (parsed.unknownFlags.size > 0) {
		const option = parsed.unknownFlags.keys().next().value;
		console.error(chalk.red(`Unknown option --${option} for "${getAuthCommandName(command.kind)}".`));
		console.error(chalk.dim(`Use "${APP_NAME} --help" or "${getAuthCommandUsage(command.kind)}".`));
		process.exitCode = 1;
		return true;
	}
	try {
		if (parsed.diagnostics.length > 0) {
			throw new AuthCommandError(parsed.diagnostics.map((diagnostic) => diagnostic.message).join("\n"));
		}
		if (command.kind !== "check") {
			const signal = AbortSignal.timeout(15_000);
			const modelRuntime = await ModelRuntime.create({ allowModelNetwork: false, signal });
			const credential = await resolveCredentialForPrint(
				parsed,
				modelRuntime,
				command.kind,
				command.minExpiryMs,
				signal,
			);
			process.stdout.write(`${credential}\n`);
			return true;
		}

		const requestedAuth = validateAuthCommandArgs(parsed, command.kind);
		let result: AuthCheckResult;
		let credential: string | undefined;

View on GitHub (pinned to 4af9d21d3b)