{"record":{"id":"8ed0916e5cb077ac","repo":"eyaltoledano/claude-task-master","slug":"code-auth-failed-8ed091","errorCode":"CODE_AUTH_FAILED","errorMessage":"Token verification failed: ${(error as Error).message}","messagePattern":"Token verification failed: (.+?)","errorType":"error_code","errorClass":"AuthenticationError","httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/integration/clients/supabase-client.ts","lineNumber":453,"sourceCode":"\t\t\tthis.logger.info('Successfully verified authentication token');\n\t\t\treturn data.session;\n\t\t} catch (error) {\n\t\t\tif (error instanceof AuthenticationError) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\t// Handle raw Supabase auth errors that might be thrown\n\t\t\tif (isSupabaseAuthError(error)) {\n\t\t\t\tconst retryResult = await this.handleRecoverableError(\n\t\t\t\t\terror,\n\t\t\t\t\tisRetry,\n\t\t\t\t\tretryFn\n\t\t\t\t);\n\t\t\t\tif (retryResult) return retryResult;\n\t\t\t\tthrow toAuthenticationError(error, 'Token verification failed');\n\t\t\t}\n\n\t\t\tthrow new AuthenticationError(\n\t\t\t\t`Token verification failed: ${(error as Error).message}`,\n\t\t\t\t'CODE_AUTH_FAILED'\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Check if MFA is required for the current session\n\t * @returns Object with required=true and factor details if MFA is required,\n\t *          or required=false if session is already at AAL2 or no MFA is configured\n\t */\n\tasync checkMFARequired(): Promise<{\n\t\trequired: boolean;\n\t\tfactorId?: string;\n\t\tfactorType?: string;\n\t}> {\n\t\tconst client = this.getClient();\n","sourceCodeStart":435,"sourceCodeEnd":471,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/integration/clients/supabase-client.ts#L435-L471","documentation":"Catch-all wrapper in SupabaseClient.verifyOneTimeCode(): when verifyOtp throws an exception that is neither an AuthenticationError nor a Supabase auth error (which are converted with friendly messages or trigger the stale-session retry), it is wrapped as AuthenticationError with code CODE_AUTH_FAILED. It means the OTP verification flow crashed unexpectedly rather than returning a normal auth error.","triggerScenarios":"client.auth.verifyOtp() throwing: network/fetch failure, client not initialized, an unexpected exception inside supabase-js, or a non-AuthApiError being thrown by an interceptor or storage layer during the call.","commonSituations":"Offline machine or blocked Supabase domain during CLI login; invalid SUPABASE_URL causing fetch to throw; corrupted local session storage raising during the request; supabase-js version incompatibility throwing instead of returning errors.","solutions":["Check network/DNS/proxy access to the Supabase project URL and retry the login.","Verify SUPABASE_URL and key configuration are correct and reachable (curl the health endpoint).","Clear the local session storage to rule out stale-state exceptions, then retry verification with a fresh token.","Read the wrapped message for the root exception; if it is a supabase-js bug, upgrade the dependency."],"exampleFix":"// before\nconst session = await client.verifyOneTimeCode(token);\n// after\ntry {\n  const session = await client.verifyOneTimeCode(token);\n} catch (e) {\n  if (e instanceof AuthenticationError && e.code === 'CODE_AUTH_FAILED') {\n    // prompt user to check connectivity and request a new token\n  }\n}","handlingStrategy":"retry","validationCode":"// guard before verifying\nif (!navigator.onLine && typeof navigator !== 'undefined') throw new Error('Offline: cannot verify token');\nif (!token) throw new Error('One-time token is required');","typeGuard":"function isAuthenticationError(e: unknown): e is AuthenticationError {\n  return e instanceof AuthenticationError;\n}","tryCatchPattern":"const verifyWithRetry = async (token: string, attempts = 3) => {\n  for (let i = 0; i < attempts; i++) {\n    try { return await client.verifyOneTimeCode(token); }\n    catch (e) {\n      if (e instanceof AuthenticationError && e.code === 'CODE_AUTH_FAILED' && i < attempts - 1) {\n        await new Promise(r => setTimeout(r, 2 ** i * 500)); // backoff for transient network issues\n        continue;\n      }\n      throw e;\n    }\n  }\n};","preventionTips":["Verify network/proxy access to the Supabase URL before CLI login flows.","Validate SUPABASE_URL points at a reachable project (health check first).","Keep supabase-js versions aligned with the server to avoid throw-instead-of-return bugs.","Retry transient failures with exponential backoff; regenerate the token for auth-level failures."],"tags":["auth","otp","network","supabase"],"backgroundTag":"otp-verification-failed","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}