can1357/oh-my-pi · error
OMP_AUTH_BROKER_URL must be set (or `auth.broker.url` in con
Error message
OMP_AUTH_BROKER_URL must be set (or `auth.broker.url` in config.yml). `migrate` uploads local credentials to a configured broker.
What it means
`runMigrate` uploads local credentials to a remote auth broker, so broker configuration is mandatory. It resolves config via `resolveAuthBrokerConfig()` (env `OMP_AUTH_BROKER_URL` or `auth.broker.url` in config.yml); when neither yields a config it throws with instructions naming both sources, preventing a silent no-op migration.
Source
Thrown at packages/coding-agent/src/cli/auth-broker-cli.ts:760
function brokerAlreadyHas(existing: Map<string, Set<string>>, provider: string, credential: AuthCredential): boolean {
const ids = existing.get(provider);
if (!ids) return false;
if (credential.type === "api_key") return ids.has("@api_key");
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.View on GitHub (pinned to 9690622007)
Solutions
- Set `OMP_AUTH_BROKER_URL=https://<broker-host>` in the environment and re-run.
- Add `auth.broker.url: https://<broker-host>` to your config.yml.
- If you don't intend to upload to a broker, don't run `migrate` — manage local credentials with `login`/`logout`.
Example fix
// before omp auth-broker migrate // no broker configured // after export OMP_AUTH_BROKER_URL=https://broker.example.com omp auth-broker migrate --from-local
Defensive patterns
Strategy: validation
Validate before calling
if (!process.env.OMP_AUTH_BROKER_URL) {
// or verify auth.broker.url exists in config.yml before invoking
console.error("Set OMP_AUTH_BROKER_URL or auth.broker.url in config.yml before migrate.");
process.exit(1);
}
await runMigrate({ fromLocal: true }); Try / catch
try {
await runMigrate({ fromLocal: true });
} catch (err) {
if (err instanceof Error && err.message.includes("OMP_AUTH_BROKER_URL must be set")) {
console.error("Configure OMP_AUTH_BROKER_URL or auth.broker.url, then retry.");
} else throw err;
} Prevention
- Export OMP_AUTH_BROKER_URL in shell profiles/CI env for machines using the broker.
- Confirm `auth.broker.url` spelling and nesting in config.yml.
- Verify broker config resolution before migrating.
When it happens
Trigger: Running `omp auth-broker migrate` where `OMP_AUTH_BROKER_URL` is unset in the environment and no `auth.broker.url` key exists in config.yml, or the config file isn't being loaded (wrong path/profile).
Common situations: Fresh workstation before configuring the broker; config.yml present but the key misnamed or wrongly nested; CI job that doesn't export `OMP_AUTH_BROKER_URL`.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- Invalid GITLAB_REDIRECT_URI: ${raw}
- GITLAB_REDIRECT_URI must use http:// or https://, got: ${raw
- GITLAB_REDIRECT_URI loopback callbacks must use http://, got
- Azure OpenAI base URL is required. Set AZURE_OPENAI_BASE_URL
- Unknown OAuth provider: ${provider}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/3ad2b8c4f7fe2950.
Report an issue: GitHub.