google-gemini/gemini-cli · warning · ValidationCancelledError
User cancelled account validation
Error message
User cancelled account validation
What it means
ValidationCancelledError is thrown when the user dismisses the account-validation prompt without choosing 'verify' or 'change_auth'. setupUser treats it as a non-recoverable abort of the onboarding flow. It only fires when a validationHandler is registered and returns a third/unknown intent.
Source
Thrown at packages/core/src/code_assist/setup.ts:200
},
});
try {
validateLoadCodeAssistResponse(loadRes);
break;
} catch (e) {
if (e instanceof ValidationRequiredError && validationHandler) {
const intent = await validationHandler(
e.validationLink,
e.validationDescription,
);
if (intent === 'verify') {
continue;
}
if (intent === 'change_auth') {
throw new ChangeAuthRequestedError();
}
throw new ValidationCancelledError();
}
throw e;
}
}
if (loadRes.currentTier) {
if (!loadRes.paidTier?.id && !loadRes.currentTier.id) {
debugLogger.warn(
'Warning: Code Assist API did not return a user tier ID. Defaulting to STANDARD tier.',
);
}
if (!loadRes.cloudaicompanionProject) {
if (projectId) {
return {
projectId,
userTier:
loadRes.paidTier?.id ??View on GitHub (pinned to 5024443c72)
Solutions
- If cancellation was intended, surface 'Account validation cancelled' to the user and exit the onboarding step.
- If your handler returned undefined by mistake, map the cancel path to a known intent string explicitly.
- To retry instead of abort, return 'verify' from the handler after re-showing the prompt.
Example fix
// before
const intent = await showPrompt(); // may return undefined
// after
const intent = (await showPrompt()) ?? 'cancel';
if (intent === 'cancel') { /* tell user, then abort */ } Defensive patterns
Strategy: try-catch
Type guard
import { ValidationCancelledError } from '../code_assist/setup.js';
function isValidationCancelled(e: unknown): e is ValidationCancelledError {
return e instanceof ValidationCancelledError;
} Try / catch
try { await setupUser(client, config); }
catch (e) {
if (e instanceof ValidationCancelledError) { ui.info('Validation cancelled.'); return; }
throw e;
} Prevention
- Map every UI dialog outcome to 'verify' or 'change_auth'; reserve a third value only if you handle the cancel.
- Show a clear 'cancelled' message rather than a stack trace.
When it happens
Trigger: loadCodeAssist raises ValidationRequiredError; validationHandler(link, description) returns undefined/null/''/'cancel' (anything other than 'verify' or 'change_auth') -> line 200 throws.
Common situations: User presses Esc/Ctrl-C in the verification prompt; UI returns undefined because the dialog was closed; programmatic caller forgot to map a 'cancel' button to one of the two known intents.
Related errors
- User requested to change authentication method
- Failed to initialize GCS bucket ${this.bucketName}: ${error}
- The enforced authentication type is '${enforcedType}', but t
- The auth type '${enforcedType}' is enforced, but no authenti
- Please set an Auth method in your ${USER_SETTINGS_PATH} or s
AI-assisted analysis of google-gemini/gemini-cli@5024443c72 (2026-08-12).
Data as JSON: /api/errors/c985d052e1c40658.
Report an issue: GitHub.