can1357/oh-my-pi · error

Usage: omp auth-broker import <file|dir> [--provider=<id>] [

Error message

Usage: omp auth-broker import <file|dir> [--provider=<id>] [--include-disabled] [--dry-run]

What it means

`runImport` requires the import target from `flags.source`; importing is meaningless without a file or directory of credential exports. When the flag is absent it throws a usage string documenting the exact command shape, so the user sees the syntax instead of a null-path crash.

Source

Thrown at packages/coding-agent/src/cli/auth-broker-cli.ts:603

			expiresAt,
			disabled: json.disabled === true,
			credential,
		});
	}
	return { entries, skipped };
}

function describeImportEntry(entry: ImportPlanEntry): string {
	const ident = entry.email ?? entry.accountId ?? "(no identity)";
	const stale = entry.expiresAt < Date.now() ? " [expired]" : "";
	const disabled = entry.disabled ? " [disabled]" : "";
	return `${entry.provider}: ${ident}${stale}${disabled} from ${entry.sourceFile}`;
}

async function runImport(flags: AuthBrokerCommandArgs["flags"]): Promise<void> {
	const target = flags.source;
	if (!target) {
		throw new Error("Usage: omp auth-broker import <file|dir> [--provider=<id>] [--include-disabled] [--dry-run]");
	}
	const resolvedTarget = path.resolve(target.startsWith("~") ? target.replace(/^~/, os.homedir()) : target);
	const { entries, skipped } = await loadImportPlan(resolvedTarget, flags.provider, flags.includeDisabled === true);

	if (flags.json) {
		process.stdout.write(
			`${JSON.stringify({
				dryRun: flags.dryRun === true,
				imported: flags.dryRun
					? []
					: entries.map(e => ({ provider: e.provider, email: e.email, file: e.sourceFile })),
				plan: entries.map(e => ({
					provider: e.provider,
					email: e.email,
					accountId: e.accountId,
					expiresAt: e.expiresAt,
					disabled: e.disabled,
					file: e.sourceFile,

View on GitHub (pinned to 9690622007)

Solutions

  1. Pass the target: `omp auth-broker import <file|dir>` (e.g. `omp auth-broker import ./exports/`).
  2. Quote paths containing spaces so argument parsing keeps them intact.
  3. Add optional flags as documented: `--provider=<id>`, `--include-disabled`, `--dry-run`.

Example fix

// before
omp auth-broker import
// after
omp auth-broker import ./auth-exports --provider=anthropic
Defensive patterns

Strategy: validation

Validate before calling

const flags: AuthBrokerCommandArgs["flags"] = parseFlags(argv);
if (!flags.source) {
  console.error("Usage: omp auth-broker import <file|dir> [--provider=<id>] [--include-disabled] [--dry-run]");
  process.exit(2);
}
await runImport(flags);

Try / catch

try {
  await runImport(flags);
} catch (err) {
  if (err instanceof Error && err.message.startsWith("Usage: omp auth-broker import")) {
    console.error(err.message);
  } else throw err;
}

Prevention

When it happens

Trigger: Running `omp auth-broker import` with no `<file|dir>` argument; a shell quoting mistake that drops the argument; calling `runImport` programmatically with default/empty flags.

Common situations: Typing the subcommand with no target; unquoted path with spaces being split by the shell; wiring `runImport` from scripts without setting `flags.source`.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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