{"record":{"id":"3ad2b8c4f7fe2950","repo":"can1357/oh-my-pi","slug":"omp-auth-broker-url-must-be-set-or-auth-broker-u","errorCode":null,"errorMessage":"OMP_AUTH_BROKER_URL must be set (or `auth.broker.url` in config.yml). `migrate` uploads local credentials to a configured broker.","messagePattern":"OMP_AUTH_BROKER_URL must be set \\(or `auth\\.broker\\.url` in config\\.yml\\)\\. `migrate` uploads local credentials to a configured broker\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/auth-broker-cli.ts","lineNumber":760,"sourceCode":"\nfunction brokerAlreadyHas(existing: Map<string, Set<string>>, provider: string, credential: AuthCredential): boolean {\n\tconst ids = existing.get(provider);\n\tif (!ids) return false;\n\tif (credential.type === \"api_key\") return ids.has(\"@api_key\");\n\tconst orgSuffix = credential.orgId ? `|org:${credential.orgId}` : \"\";\n\tif (credential.email && ids.has(`email:${credential.email}${orgSuffix}`)) return true;\n\tif (credential.accountId && ids.has(`accountId:${credential.accountId}${orgSuffix}`)) return true;\n\tif (credential.projectId && ids.has(`projectId:${credential.projectId}${orgSuffix}`)) return true;\n\tif (!credential.email && !credential.accountId && !credential.projectId && credential.orgId) {\n\t\treturn ids.has(`org:${credential.orgId}`);\n\t}\n\treturn false;\n}\n\nasync function runMigrate(flags: AuthBrokerCommandArgs[\"flags\"]): Promise<void> {\n\tconst brokerConfig = await resolveAuthBrokerConfig();\n\tif (!brokerConfig) {\n\t\tthrow new Error(\n\t\t\t\"OMP_AUTH_BROKER_URL must be set (or `auth.broker.url` in config.yml). `migrate` uploads local credentials to a configured broker.\",\n\t\t);\n\t}\n\tif (flags.fromLocal !== true) {\n\t\tthrow new Error(\n\t\t\t\"`omp auth-broker migrate` requires an explicit source. Pass `--from-local` to migrate from the local SQLite store and env vars.\",\n\t\t);\n\t}\n\n\tconst client = new AuthBrokerClient({ url: brokerConfig.url, token: brokerConfig.token });\n\tconst snapshotResult = await client.fetchSnapshot();\n\tif (snapshotResult.status !== 200) throw new Error(\"Auth broker returned no snapshot\");\n\tconst existing = indexBrokerSnapshot(snapshotResult.snapshot);\n\n\tconst plan: MigratePlanEntry[] = [];\n\tconst skipped: MigrateSkip[] = [];\n\n\t// 1. Local SQLite rows.","sourceCodeStart":742,"sourceCodeEnd":778,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/auth-broker-cli.ts#L742-L778","documentation":"`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.","triggerScenarios":"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).","commonSituations":"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`.","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`."],"exampleFix":"// before\nomp auth-broker migrate   // no broker configured\n// after\nexport OMP_AUTH_BROKER_URL=https://broker.example.com\nomp auth-broker migrate --from-local","handlingStrategy":"validation","validationCode":"if (!process.env.OMP_AUTH_BROKER_URL) {\n  // or verify auth.broker.url exists in config.yml before invoking\n  console.error(\"Set OMP_AUTH_BROKER_URL or auth.broker.url in config.yml before migrate.\");\n  process.exit(1);\n}\nawait runMigrate({ fromLocal: true });","typeGuard":null,"tryCatchPattern":"try {\n  await runMigrate({ fromLocal: true });\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"OMP_AUTH_BROKER_URL must be set\")) {\n    console.error(\"Configure OMP_AUTH_BROKER_URL or auth.broker.url, then retry.\");\n  } else throw err;\n}","preventionTips":["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."],"tags":["configuration","env-var","oauth"],"backgroundTag":"missing-env-var","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}