can1357/oh-my-pi · error

OAuth login already in progress for ${pendingProvider}. Comp

Error message

OAuth login already in progress for ${pendingProvider}. Complete or cancel it before starting MCP OAuth.

What it means

MCP OAuth setup refuses to start when the shared manual-input UI slot is already claimed by another OAuth flow. manualInput.hasPending() is checked at flow start; if a previous provider's manual code entry is still awaiting user input, this error names that provider and asks the user to finish or cancel it first.

Source

Thrown at packages/coding-agent/src/modes/controllers/mcp-command-controller.ts:893

			if (!oauthTimeout.signal.aborted) oauthTimeout.abort(reason);
		};
		const flowClaim = await claimMCPOAuthFlow(manualInput, requestCancellation);
		const originalOnEscape = this.ctx.editor.onEscape;
		this.ctx.editor.onEscape = () => requestCancellation(MCP_OAUTH_USER_CANCEL_REASON);
		const externalSignal = opts?.abortSignal;
		const onExternalAbort = (): void => {
			const reason = externalSignal?.reason;
			requestCancellation(typeof reason === "string" ? reason : MCP_OAUTH_USER_CANCEL_REASON);
		};
		if (externalSignal?.aborted) {
			onExternalAbort();
		} else {
			externalSignal?.addEventListener("abort", onExternalAbort, { once: true });
		}
		try {
			if (manualInput.hasPending()) {
				const pendingProvider = manualInput.pendingProviderId ?? "another provider";
				throw new Error(
					`OAuth login already in progress for ${pendingProvider}. Complete or cancel it before starting MCP OAuth.`,
				);
			}
			// Create OAuth flow
			const flow = new MCPOAuthFlow(
				{
					authorizationUrl: authUrl,
					tokenUrl: tokenUrl,
					registrationUrl: opts?.registrationUrl,
					issuerUrl: opts?.issuerUrl,
					clientId: resolvedClientId,
					clientSecret: resolvedClientSecret,
					scopes: scopes || undefined,
					prompt: opts?.prompt,
					redirectUri: opts?.redirectUri,
					callbackPort: opts?.callbackPort,
					callbackPath: opts?.callbackPath,
					resource: opts?.resource,

View on GitHub (pinned to 9690622007)

Solutions

  1. Complete or cancel the in-progress OAuth login for the named provider before starting a new one
  2. Press Esc / cancel the pending manual-code prompt, then re-run the MCP OAuth flow
  3. Restart the session if the pending claim is orphaned and cannot be cancelled via UI
Defensive patterns

Strategy: validation

Validate before calling

// Check before starting the flow
if (manualInput.hasPending()) {
  console.log(`Finish or cancel OAuth for ${manualInput.pendingProviderId ?? 'another provider'} first.`);
  return;
}
await startMcpOAuth(...);

Try / catch

try {
  await startMcpOAuth(...);
} catch (err) {
  if (err instanceof Error && err.message.includes('already in progress')) {
    // surface which provider holds the slot and offer to cancel it
  }
}

Prevention

When it happens

Trigger: Starting a new MCP OAuth flow while a prior OAuth login (another provider) still holds the manual input prompt — e.g. the user began one provider's device-code flow, abandoned it, and immediately started a second flow.

Common situations: Switching between MCP servers and re-running the auth command before completing the first; a hung/abandoned OAuth prompt from a crashed or interrupted flow that never released its claim.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/8c48b1589437d5c3. Report an issue: GitHub.