{"record":{"id":"c0b9a63a492bdbce","repo":"eyaltoledano/claude-task-master","slug":"mfa-verification-failed-c0b9a6","errorCode":"MFA_VERIFICATION_FAILED","errorMessage":"MFA verification cancelled","messagePattern":"MFA verification cancelled","errorType":"error_code","errorClass":"AuthenticationError","httpStatus":null,"severity":"info","filePath":"apps/cli/src/utils/auth-ui.ts","lineNumber":164,"sourceCode":"\n\t\t\t\t\tif (!/^\\d{6}$/.test(trimmed)) {\n\t\t\t\t\t\treturn 'MFA code must be exactly 6 digits (0-9)';\n\t\t\t\t\t}\n\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t]);\n\n\t\treturn response.mfaCode.trim();\n\t} catch (error: any) {\n\t\t// Handle user cancellation (Ctrl+C)\n\t\tif (\n\t\t\terror.name === 'ExitPromptError' ||\n\t\t\terror.message?.includes('force closed')\n\t\t) {\n\t\t\tui.displayWarning(' MFA verification cancelled by user');\n\t\t\tthrow new AuthenticationError(\n\t\t\t\t'MFA verification cancelled',\n\t\t\t\t'MFA_VERIFICATION_FAILED'\n\t\t\t);\n\t\t}\n\t\tthrow error;\n\t}\n}\n\n/**\n * Display MFA verification success\n */\nexport function displayMFASuccess(): void {\n\tconsole.log(chalk.green('\\n✓ MFA verification successful!'));\n}\n\n/**\n * Display invalid MFA code message\n * @param remaining - Number of attempts remaining","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/apps/cli/src/utils/auth-ui.ts#L146-L182","documentation":"promptForMFACode throws an AuthenticationError with code MFA_VERIFICATION_FAILED when the user cancels the MFA code prompt (Ctrl+C / ExitPromptError / 'force closed'). It converts the prompt-library abort signal into a typed auth error so callers can distinguish user cancellation from real verification failures. The raw prompt error is intentionally not propagated.","triggerScenarios":"User presses Ctrl+C (or the terminal force-closes the prompt) while the interactive MFA code prompt from @inquirer/prompts is waiting for input during CLI authentication.","commonSituations":"User starts CLI login, is prompted for an MFA code, and aborts with Ctrl+C; scripts killing the CLI mid-prompt; non-interactive terminals rejecting the prompt.","solutions":["This is expected user cancellation: catch AuthenticationError with code MFA_VERIFICATION_FAILED and exit gracefully without retry","If it should not be cancellable, re-run the auth flow without prompting or supply credentials non-interactively","Check that the terminal environment supports interactive prompts (TTY present) when running in CI/scripts"],"exampleFix":"// before\ntry { await login(); } catch (e) { console.error(e); }\n// after\ntry { await login(); } catch (e) {\n  if (e instanceof AuthenticationError && e.code === 'MFA_VERIFICATION_FAILED') {\n    console.log('Login cancelled by user.');\n    return;\n  }\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await authenticate(); } catch (e) {\n  if (e instanceof AuthenticationError && e.code === 'MFA_VERIFICATION_FAILED') {\n    // treat as user cancellation: log and exit cleanly\n    return;\n  }\n  throw e;\n}","preventionTips":["Detect non-interactive environments (no TTY) before prompting and use token-based auth instead","Document that Ctrl+C during MFA prompt cancels login","In scripts, prefer API-key or non-interactive auth to avoid prompts entirely"],"tags":["cli","mfa","authentication","user-cancellation"],"backgroundTag":"mfa-verification-cancelled","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}