{"record":{"id":"6e63e71e662cd5e0","repo":"can1357/oh-my-pi","slug":"no-oauth-providers-registered","errorCode":null,"errorMessage":"No OAuth providers registered","messagePattern":"No OAuth providers registered","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/auth-broker-cli.ts","lineNumber":353,"sourceCode":"\t\t}\n\t};\n\n\tif (supportsRawMode) {\n\t\treadline.emitKeypressEvents(input, rl);\n\t\tinput.setRawMode(true);\n\t\tinput.on(\"keypress\", onKeypress);\n\t}\n\n\trl.once(\"SIGINT\", onSigint);\n\trl.question(question, answer => {\n\t\tfinish(() => resolve(answer));\n\t});\n\treturn promise;\n}\n\nasync function pickProviderInteractively(providers: readonly OAuthProviderInfo[]): Promise<string> {\n\tif (providers.length === 0) {\n\t\tthrow new Error(\"No OAuth providers registered\");\n\t}\n\tconst rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n\ttry {\n\t\tprocess.stdout.write(\"Select a provider:\\n\\n\");\n\t\tfor (let i = 0; i < providers.length; i++) {\n\t\t\tprocess.stdout.write(`  ${i + 1}. ${providers[i].name}\\n`);\n\t\t}\n\t\tprocess.stdout.write(\"\\n\");\n\t\tconst choice = await promptLine(rl, `Enter number (1-${providers.length}): `);\n\t\tconst index = Number.parseInt(choice, 10) - 1;\n\t\tif (Number.isNaN(index) || index < 0 || index >= providers.length) {\n\t\t\tthrow new Error(`Invalid selection: ${choice}`);\n\t\t}\n\t\treturn providers[index].id;\n\t} finally {\n\t\trl.close();\n\t}\n}","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/auth-broker-cli.ts#L335-L371","documentation":"`pickProviderInteractively` renders a numbered menu of registered OAuth providers for interactive login. It throws immediately when the provider list is empty, because there is nothing to present or select and the login flow cannot possibly succeed. This is a guard against prompting with zero options.","triggerScenarios":"Calling `omp auth-broker login` without a `--provider` id, so `runLogin` reaches `pickProviderInteractively`, while the registered provider list is empty (no provider plugins/config loaded, or all providers filtered out).","commonSituations":"Fresh install with no OAuth providers configured; a CI/container environment that excludes all providers; broken provider registration/loading that silently yields an empty list.","solutions":["Register/configure at least one OAuth provider before running `omp auth-broker login`.","Pass an explicit provider id (`--provider=<id>`) so the interactive picker is skipped.","Check provider registration/loading logs for errors that dropped all providers."],"exampleFix":"// before\nomp auth-broker login            // zero providers registered\n// after\nomp auth-broker login --provider=anthropic","handlingStrategy":"validation","validationCode":"import { listOAuthProviders } from \"./auth\";\nconst providers = await listOAuthProviders();\nif (providers.length === 0) {\n  console.error(\"No OAuth providers registered; configure one before login.\");\n  process.exit(1);\n}\nawait runLogin(flags);","typeGuard":null,"tryCatchPattern":"try {\n  await runLogin(flags);\n} catch (err) {\n  if (err instanceof Error && err.message === \"No OAuth providers registered\") {\n    console.error(\"Configure at least one OAuth provider before running login.\");\n  } else throw err;\n}","preventionTips":["Verify provider registration with a list/status command before scripting logins.","Prefer `--provider=<id>` over interactive selection in automation.","Log provider loading failures so silent empty lists are visible."],"tags":["oauth","cli","configuration"],"backgroundTag":"no-oauth-providers-registered","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}