Skip to content

Intermittent IDP authentication failure: Intent has not succeeded (IDP-nme4gszsvx) #57

@scotwells

Description

@scotwells

Problem

Users are intermittently experiencing authentication failures when using external identity providers (Google, GitHub, etc.) with the error:

ConnectError [failed_precondition] Intent has not succeeded (IDP-nme4gszsvx)

Root Cause Analysis

Primary Cause: Zitadel Multi-Replica Race Condition

The error originates from Zitadel's backend (internal/api/grpc/user/v2/intent.go) when retrieveIdentityProviderIntent is called before the intent has transitioned to the Succeeded state.

Known Issue: zitadel/zitadel#10932

When running multiple Zitadel replicas:

  1. User completes IDP authentication → callback processed by Replica A
  2. Intent transitions to Succeeded state in event store
  3. auth-ui calls RetrieveIdentityProviderIntent which hits Replica B
  4. Replica B hasn't synced the event yet
  5. Intent appears as Started → Error thrown

Fixed in: Zitadel v4.6.2 (PR #11014)

Secondary Cause: Missing Error Handling in auth-ui

In apps/login/src/app/(main)/(boxed)/idp/[provider]/success/page.tsx at line 149:

const intent = await retrieveIDPIntent({
  serviceUrl,
  id,
  token,
});

This call has no try-catch block. When Zitadel returns the failed_precondition error, it propagates as an unhandled exception.

Proposed Solution

Short-term Fix (auth-ui)

  1. Add error handling around retrieveIDPIntent() call
  2. Implement retry logic with exponential backoff for the race condition
  3. Provide user-friendly error message with retry option
let intent;
try {
  intent = await retrieveIDPIntentWithRetry({
    serviceUrl,
    id,
    token,
  });
} catch (error) {
  Sentry.captureException(error, {
    tags: { flow: 'idp_intent_retrieval', provider },
    extra: { intentId: id },
  });
  
  if (error?.message?.includes('IDP-nme4gszsvx')) {
    return loginFailed("Authentication is still processing. Please try again.");
  }
  
  return loginFailed("Authentication failed. Please try again.");
}

Long-term Fix

Upgrade Zitadel from v3.3.2 to v4.6.2+ which contains the race condition fix.

Affected Files

File Lines Issue
apps/login/src/app/(main)/(boxed)/idp/[provider]/success/page.tsx 149-153 Missing error handling
apps/login/src/lib/zitadel.ts 1329-1347 retrieveIDPIntent() - no retry logic

Related Issues

Labels

  • bug
  • authentication
  • idp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions