{"record":{"id":"a34d979b53d1f209","repo":"coleam00/Archon","slug":"oauth-provider-oauthauth-name-requested-a-man","errorCode":null,"errorMessage":"OAuth provider '${oauthAuth.name}' requested a manual code but no onManualCodeInput callback was supplied.","messagePattern":"OAuth provider '(.+?)' requested a manual code but no onManualCodeInput callback was supplied\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/providers/src/oauth.ts","lineNumber":128,"sourceCode":"    credentials: OAuthCredential,\n    options?: { signal?: AbortSignal }\n  ): Promise<OAuthCredential>;\n  getApiKey(credentials: OAuthCredential): Promise<{ apiKey: string }>;\n}\n\n/* ─── Adapter: `OAuthAuth` (pi-ai ≥ 0.84) → legacy callback-driven surface ── */\n\n/** Map the SDK's `interaction` prompts/events onto the legacy callbacks. */\nfunction adaptLoginCallbacks(\n  oauthAuth: OAuthAuth,\n  callbacks: OAuthLoginCallbacks\n): ProviderAuthInteraction {\n  return {\n    signal: callbacks.signal ?? new AbortController().signal,\n    prompt: async (prompt: AuthPrompt): Promise<string> => {\n      if (prompt.type === 'manual_code') {\n        if (!callbacks.onManualCodeInput) {\n          throw new Error(\n            `OAuth provider '${oauthAuth.name}' requested a manual code but no onManualCodeInput callback was supplied.`\n          );\n        }\n        return callbacks.onManualCodeInput();\n      }\n      if (prompt.type === 'select') {\n        return (await callbacks.onSelect({ options: prompt.options })) ?? '';\n      }\n      // text / secret — Pi uses these for one-off prompts (e.g. github-copilot\n      // enterprise domain). The caller decides how to answer; the Archon\n      // bridge has no interactive channel and returns \"\" (blank default).\n      return callbacks.onPrompt(prompt);\n    },\n    notify: (event: AuthEvent): void => {\n      if (event.type === 'auth_url') {\n        callbacks.onAuth({ url: event.url, instructions: event.instructions });\n        return;\n      }","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/providers/src/oauth.ts#L110-L146","documentation":"adaptLoginCallbacks wraps caller-supplied callbacks into the Pi SDK's ProviderAuthInteraction. When the OAuth flow reaches a prompt of type 'manual_code' (the provider requires the user to paste a code/device code manually) but the caller passed no onManualCodeInput callback, there is no way to obtain the code, so login aborts with this error instead of hanging.","triggerScenarios":"Calling login() for a provider whose oauthAuth flow emits a manual_code AuthPrompt while the callbacks argument omitted onManualCodeInput.","commonSituations":"Headless/CI logins for providers that fall back to device-code or manual paste flows; interactive OAuth unavailable so Pi downgrades to manual code entry; caller assumed a fully automatic browser flow and didn't wire the callback.","solutions":["Pass an onManualCodeInput callback in the callbacks object that prompts the user (or reads stdin) and returns the code","Run the login in an environment that supports the automatic browser flow so no manual code is requested","For automation, pre-provision credentials instead of running the interactive login flow"],"exampleFix":"// before\nawait login('anthropic', { signal });\n// after\nawait login('anthropic', {\n  signal,\n  onManualCodeInput: async () => {\n    const code = await promptUser('Enter the code: ');\n    return code;\n  }\n});","handlingStrategy":"validation","validationCode":"if (typeof callbacks?.onManualCodeInput !== 'function') {\n  throw new Error('login() requires onManualCodeInput for providers with manual code flows');\n}","typeGuard":"function hasManualCodeInput(\n  c: ProviderLoginCallbacks\n): c is ProviderLoginCallbacks & Required<Pick<ProviderLoginCallbacks, 'onManualCodeInput'>> {\n  return typeof c.onManualCodeInput === 'function';\n}","tryCatchPattern":"try {\n  await login(providerId, callbacks);\n} catch (err) {\n  if (String(err.message).includes('manual code')) {\n    console.error('Re-run login with an onManualCodeInput callback.');\n  }\n  throw err;\n}","preventionTips":["Always supply onManualCodeInput when login may run headless","Prefer environments where the automatic browser flow succeeds","Pre-provision credentials for CI instead of interactive logins"],"tags":["oauth","login","interactive-prompt","missing-callback"],"backgroundTag":"missing-required-callback","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}