can1357/oh-my-pi · error

`omp auth-broker migrate` requires an explicit source. Pass

Error message

`omp auth-broker migrate` requires an explicit source. Pass `--from-local` to migrate from the local SQLite store and env vars.

What it means

Migrate requires the user to explicitly opt in to the credential source. Even with a broker configured, `runMigrate` throws unless `flags.fromLocal` is exactly `true`, because uploading the local SQLite store and env vars is an explicit, potentially sensitive action. This guards against accidental pushes from the wrong machine.

Source

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

	const orgSuffix = credential.orgId ? `|org:${credential.orgId}` : "";
	if (credential.email && ids.has(`email:${credential.email}${orgSuffix}`)) return true;
	if (credential.accountId && ids.has(`accountId:${credential.accountId}${orgSuffix}`)) return true;
	if (credential.projectId && ids.has(`projectId:${credential.projectId}${orgSuffix}`)) return true;
	if (!credential.email && !credential.accountId && !credential.projectId && credential.orgId) {
		return ids.has(`org:${credential.orgId}`);
	}
	return false;
}

async function runMigrate(flags: AuthBrokerCommandArgs["flags"]): Promise<void> {
	const brokerConfig = await resolveAuthBrokerConfig();
	if (!brokerConfig) {
		throw new Error(
			"OMP_AUTH_BROKER_URL must be set (or `auth.broker.url` in config.yml). `migrate` uploads local credentials to a configured broker.",
		);
	}
	if (flags.fromLocal !== true) {
		throw new Error(
			"`omp auth-broker migrate` requires an explicit source. Pass `--from-local` to migrate from the local SQLite store and env vars.",
		);
	}

	const client = new AuthBrokerClient({ url: brokerConfig.url, token: brokerConfig.token });
	const snapshotResult = await client.fetchSnapshot();
	if (snapshotResult.status !== 200) throw new Error("Auth broker returned no snapshot");
	const existing = indexBrokerSnapshot(snapshotResult.snapshot);

	const plan: MigratePlanEntry[] = [];
	const skipped: MigrateSkip[] = [];

	// 1. Local SQLite rows.
	const localDbPath = getAgentDbPath();
	const localStore = await SqliteAuthCredentialStore.open(localDbPath);
	const plannedApiKeyProviders = new Set<string>();
	try {
		for (const row of localStore.listAuthCredentials()) {

View on GitHub (pinned to 9690622007)

Solutions

  1. Re-run with the explicit source flag: `omp auth-broker migrate --from-local`.
  2. Check flag spelling (`--from-local`, hyphenated) so it parses into `flags.fromLocal`.
  3. Review the migration scope first (e.g. `--dry-run` if available), then run the real migration.

Example fix

// before
omp auth-broker migrate
// after
OMP_AUTH_BROKER_URL=https://broker.example.com omp auth-broker migrate --from-local
Defensive patterns

Strategy: validation

Validate before calling

const flags: AuthBrokerCommandArgs["flags"] = { fromLocal: true };
if (flags.fromLocal !== true) {
  console.error("migrate requires explicit --from-local");
  process.exit(2);
}
await runMigrate(flags);

Try / catch

try {
  await runMigrate(flags);
} catch (err) {
  if (err instanceof Error && err.message.includes("requires an explicit source")) {
    console.error("Re-run with --from-local to migrate from the local SQLite store and env vars.");
  } else throw err;
}

Prevention

When it happens

Trigger: Running `omp auth-broker migrate` with a broker URL configured but without `--from-local`; passing unsupported flags (`--from-file`); a typo like `--fromlocal` that parses to nothing.

Common situations: Following an older guide that omitted the flag; assuming migration starts automatically once the broker URL is set; scripted runs passing only the broker env var.

Related errors


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