can1357/oh-my-pi · error

Usage: omp auth-broker login <provider> --via=user@host (pro

Error message

Usage: omp auth-broker login <provider> --via=user@host (provider required for remote login)

What it means

`omp auth-broker login` requires a provider argument when --via (remote host) is given, because the remote broker must know which OAuth provider to use. Omitting the provider while supplying --via throws this usage Error before any network call.

Source

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

		} else {
			process.stdout.write(`${next}\n`);
		}
		return;
	}
	const token = await ensureToken();
	if (flags.json) {
		process.stdout.write(`${JSON.stringify({ token, path: getTokenFilePath() })}\n`);
	} else {
		process.stdout.write(`${token}\n`);
	}
}

async function runLogin(flags: AuthBrokerCommandArgs["flags"]): Promise<void> {
	const providers = getOAuthProviders();
	let providerArg = flags.provider;
	if (!providerArg) {
		if (flags.via) {
			throw new Error(
				"Usage: omp auth-broker login <provider> --via=user@host (provider required for remote login)",
			);
		}
		providerArg = await pickProviderInteractively(providers);
	}
	if (!providers.some(p => p.id === providerArg)) {
		throw new Error(
			`Unknown OAuth provider '${providerArg}'. Known: ${providers
				.map(p => p.id)
				.sort()
				.join(", ")}`,
		);
	}
	if (flags.via) {
		await runRemoteLogin(providerArg, flags.via, flags.dryRun ?? false);
		return;
	}
	await runLocalLogin(providerArg as OAuthProvider);

View on GitHub (pinned to 9690622007)

Solutions

  1. Add the provider positional: omp auth-broker login <provider> --via=user@host (e.g. anthropic, openai).
  2. If a local login was intended, drop --via and let the interactive picker choose the provider.
  3. List known providers by checking the error output of an invalid provider or the docs.

Example fix

// before
omp auth-broker login --via=me@server
// after
omp auth-broker login anthropic --via=me@server
Defensive patterns

Strategy: validation

Validate before calling

if (flags.via && !flags._.length) {
  throw new Error("provider positional required with --via: omp auth-broker login <provider> --via=user@host");
}

Type guard

null

Try / catch

try {
  await runAuthBrokerCommand(args);
} catch (err) {
  if (err instanceof Error && err.message.startsWith("Usage: omp auth-broker login")) {
    console.error("Supply a provider before --via, or drop --via for interactive local login.");
    process.exitCode = 2;
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: Running `omp auth-broker login --via=user@host` with no <provider> positional. Local (non-remote) logins without --via are fine — they fall back to an interactive provider picker.

Common situations: Following remote-login docs but forgetting the positional argument, or scripting the command from a template where the provider placeholder was empty.

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/0b58b09c4f5b4136. Report an issue: GitHub.