eyaltoledano/claude-task-master · error · AuthenticationError

PKCE_FAILED

PKCE_FAILED

Error message

Failed to start PKCE flow: ${(error as Error).message}

What it means

signInWithPKCE wraps any non-AuthenticationError thrown during the flow (network failures, storage errors, unexpected exceptions) in an AuthenticationError with code PKCE_FAILED, preserving the original error message.

Source

Thrown at packages/tm-core/src/modules/integration/clients/supabase-client.ts:174

			if (!data?.url) {
				throw new AuthenticationError(
					'No authorization URL returned',
					'INVALID_RESPONSE'
				);
			}

			// Extract code_verifier from the URL or generate it
			// Note: Supabase handles PKCE internally, we just need to handle the callback
			return {
				url: data.url,
				codeVerifier: '' // Supabase manages this internally
			};
		} catch (error) {
			if (error instanceof AuthenticationError) {
				throw error;
			}

			throw new AuthenticationError(
				`Failed to start PKCE flow: ${(error as Error).message}`,
				'PKCE_FAILED'
			);
		}
	}

	/**
	 * Exchange authorization code for session (PKCE flow)
	 */
	async exchangeCodeForSession(code: string): Promise<Session> {
		const client = this.getClient();

		try {
			const { data, error } = await client.auth.exchangeCodeForSession(code);

			if (error) {
				throw new AuthenticationError(
					`Failed to exchange code: ${error.message}`,

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Check network connectivity to the Supabase project
  2. Retry the sign-in once connectivity is restored
  3. Inspect the embedded message for the underlying cause (e.g. fetch failed, storage error)

Example fix

null
Defensive patterns

Strategy: retry

Validate before calling

null

Type guard

null

Try / catch

try {
  await client.signInWithPKCE();
} catch (e) {
  if (e instanceof AuthenticationError && e.code === 'PKCE_FAILED' && isTransient(e.message)) {
    await client.signInWithPKCE(); // one retry for network blips
  }
}

Prevention

When it happens

Trigger: Any exception inside signInWithPKCE other than the Supabase-returned errors already handled: network timeouts fetching the authorization URL, errors generating/extracting the code_verifier, storage adapter failures.

Common situations: Offline machine or DNS failure, firewall blocking api.supabase.co, keychain/storage backend unavailable when persisting PKCE state.

Related errors


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/8d4aae772eb1348f. Report an issue: GitHub.