atuinsh/atuin · error
unexpected two-factor requirement during registration
Error message
unexpected two-factor requirement during registration
What it means
During `atuin register`, the server responded with AuthResponse::TwoFactorRequired. Two-factor is only expected during login, not account creation, so the CLI treats this as an unexpected server state and aborts. It indicates a mismatch between what the local client is doing (registration) and the server-side state of the account (which apparently already exists with 2FA enabled).
Source
Thrown at crates/atuin/src/command/client/account/register.rs:93
let is_hub_token =
auth_type.as_deref() == Some("hub") || session.starts_with("atapi_");
if is_hub_token {
meta.save_hub_session(&session).await?;
} else {
meta.save_session(&session).await?;
println!(
"\nNote: Your account has not been fully migrated to Atuin Hub."
);
println!(
"Sync will continue to work, but you can visit hub.atuin.sh to \
create a new Hub account and link it to your existing CLI \
account."
);
}
}
AuthResponse::TwoFactorRequired => {
bail!("unexpected two-factor requirement during registration");
}
}
let _key = paseto_v4::Key::try_load_or_generate(&settings.key_path)?;
println!(
"Registration successful! Please make a note of your key (run 'atuin key') \
and keep it safe."
);
println!(
"You will need it to log in on other devices, and we cannot help recover it \
if you lose it."
);
} else {
// Interactive registration: delegate to the browser OAuth flow.
// Registration on Hub happens on the website; the CLI just needs
// to authenticate afterwards.
super::login::Cmd {View on GitHub (pinned to c0c717ab04)
Solutions
- Use `atuin login` (with your 2FA code when prompted) instead of `atuin register` — the account already exists.
- Choose a different username if you truly want a new account.
- Check you are pointing at the intended sync server (`sync.address` in config) — you may be hitting a different instance than expected.
- If the old account is unwanted, delete it on the server before registering the same username.
Example fix
// before atuin register --username ellie --password '...' // error: unexpected two-factor requirement during registration // after atuin login --username ellie # enter password + 2FA code when prompted
Defensive patterns
Strategy: validation
Validate before calling
# check whether the account exists before registering atuin login --username "$USER" --password-stdin < /dev/null 2>&1 | grep -qi 'two-factor\|incorrect' && echo 'account likely exists; use atuin login'
Prevention
- Use `atuin login` for existing accounts, `atuin register` only for brand-new ones.
- Keep one canonical sync_address in config to avoid hitting the wrong server.
- Record which usernames are already registered on your sync server.
When it happens
Trigger: Running `atuin register --username <u> --email <e> --password <p>` against a sync server where the username already has an account with two-factor authentication enabled, so the server replies TwoFactorRequired instead of a registration success.
Common situations: Re-registering against the same server after already creating an account; pointing sync_address at a server where the username is taken by a 2FA-enabled account; stale muscle memory trying to 'reset' an account by re-registering instead of logging in.
Related errors
- You are not logged in
- You are not logged in
- No CLI session found. Please log in first with 'atuin login'
- please provide a password
- Failed to read from input
AI-assisted analysis of atuinsh/atuin@c0c717ab04 (2026-09-12).
Data as JSON: /api/errors/e5e08e62f3309178.
Report an issue: GitHub.