{"record":{"id":"fc9deba0807f6be3","repo":"can1357/oh-my-pi","slug":"no-known-oauth-callback-port-for-provider-us","errorCode":null,"errorMessage":"No known OAuth callback port for '${provider}'. Use device-code flow on the broker host directly.","messagePattern":"No known OAuth callback port for '(.+?)'\\. Use device-code flow on the broker host directly\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/auth-broker-cli.ts","lineNumber":376,"sourceCode":"\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}\n\nasync function runRemoteLogin(provider: string, via: string, dryRun: boolean): Promise<void> {\n\tconst port = CALLBACK_PORTS[provider];\n\tif (port === undefined) {\n\t\tthrow new Error(\n\t\t\t`No known OAuth callback port for '${provider}'. Use device-code flow on the broker host directly.`,\n\t\t);\n\t}\n\tconst sshArgs = [\n\t\t\"-L\",\n\t\t`${port}:127.0.0.1:${port}`,\n\t\t\"-o\",\n\t\t\"ExitOnForwardFailure=yes\",\n\t\tvia,\n\t\t`${APP_NAME} auth-broker login ${provider}`,\n\t];\n\tif (dryRun) {\n\t\tprocess.stdout.write(`ssh ${sshArgs.map(a => (a.includes(\" \") ? `'${a}'` : a)).join(\" \")}\\n`);\n\t\treturn;\n\t}\n\tconst sshBin = $which(\"ssh\");\n\tif (!sshBin) {\n\t\tthrow new Error(\"ssh binary not found in PATH\");","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/auth-broker-cli.ts#L358-L394","documentation":"`runRemoteLogin` sets up an SSH local port-forward for the OAuth callback and needs the provider's registered callback port from the `CALLBACK_PORTS` table. Providers without an entry cannot receive the OAuth redirect through the tunnel, so the function throws and suggests running the device-code flow on the broker host.","triggerScenarios":"`omp auth-broker login --via <host>` (remote login) with a provider id that is not a key in `CALLBACK_PORTS` — typo'd id, a newly added provider missing from the table, or a provider that only supports device-code flow.","commonSituations":"Typing the provider id by hand; adding a new OAuth provider without updating `CALLBACK_PORTS`; attempting remote login for device-code-only providers.","solutions":["Run the device-code login flow directly on the broker host (ssh in, then `omp auth-broker login` there).","Check the exact provider id spelling against `CALLBACK_PORTS` in auth-broker-cli.ts.","Add the provider's callback port to `CALLBACK_PORTS` if it supports the redirect flow and is missing."],"exampleFix":"// before (auth-broker-cli.ts)\nconst CALLBACK_PORTS = { anthropic: 51145 };\n// after\nconst CALLBACK_PORTS = { anthropic: 51145, github: 51146 };","handlingStrategy":"validation","validationCode":"const CALLBACK_PORTS = { anthropic: 51145 } as Record<string, number>;\nif (!(providerId in CALLBACK_PORTS)) {\n  console.warn(`${providerId} has no callback port; use device-code flow on the broker host.`);\n}\nawait runLogin({ provider: providerId, via: host });","typeGuard":null,"tryCatchPattern":"try {\n  await runLogin({ provider, via: host });\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"No known OAuth callback port\")) {\n    console.error(`Remote login unsupported for ${provider}; run device-code flow on the broker host.`);\n  } else throw err;\n}","preventionTips":["Copy provider ids exactly from the `CALLBACK_PORTS` table in auth-broker-cli.ts.","Add new providers' callback ports to `CALLBACK_PORTS` when registering them.","For providers without a port, use device-code login directly on the broker host."],"tags":["oauth","ssh","configuration"],"backgroundTag":"missing-callback-port","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}