hashicorp/vagrant · info
Requesting 2FA code via #{delivery_method.upcase}...
Error message
Requesting 2FA code via #{delivery_method.upcase}... What it means
Informational notice printed by the cloud client (plugins/commands/cloud/client/client.rb) at the start of request_code, the 2FA delivery step of `vagrant cloud auth login`. It announces 'Requesting 2FA code via SMS/EMAIL...' (delivery_method upcased), scrubs the password from logs via CredentialScrubber, calls authentication_request_2fa_code, and on success prints '2FA code sent to <obfuscated destination>.' It is a progress message, not a failure.
Source
Thrown at plugins/commands/cloud/client/client.rb:98
Vagrant::Util::CredentialScrubber.sensitive(password)
with_error_handling do
r = client.authentication_token_create(username: username_or_email,
password: password, description: description, code: code)
Vagrant::Util::CredentialScrubber.sensitive(r[:token])
@client = VagrantCloud::Client.new(
access_token: r[:token],
url_base: api_server_url
)
r[:token]
end
end
# Requests a 2FA code
# @param [String] delivery_method
def request_code(delivery_method)
@env.ui.warn("Requesting 2FA code via #{delivery_method.upcase}...")
Vagrant::Util::CredentialScrubber.sensitive(password)
with_error_handling do
r = client.authentication_request_2fa_code(
username: username_or_email, password: password, delivery_method: delivery_method)
two_factor = r[:two_factor]
obfuscated_destination = two_factor[:obfuscated_destination]
@env.ui.success("2FA code sent to #{obfuscated_destination}.")
end
end
# Stores the given token locally, removing any previous tokens.
#
# @param [String] token
def store_token(token)
Vagrant::Util::CredentialScrubber.sensitive(token)View on GitHub (pinned to 35f3160f4a)
Solutions
- Check the announced channel and your device for the code, then enter it at the prompt.
- If the code never arrives, verify the delivery method configured on your Vagrant Cloud account and retry login.
- For non-interactive automation, avoid 2FA entirely: create a personal access token (vagrant cloud auth token) in the web UI and use `vagrant cloud auth login --token`.
- If request fails, the surrounding with_error_handling block surfaces the VagrantCloud error — fix credentials/network based on that message.
Example fix
# before (interactive, 2FA each time) vagrant cloud auth login # -> Requesting 2FA code via SMS... # after (automation: token, no 2FA prompt) vagrant cloud auth login --token $VAGRANT_CLOUD_TOKEN
Defensive patterns
Strategy: fallback
Validate before calling
# skip interactive 2FA in automation: pre-provision a token
[ -n "$VAGRANT_CLOUD_TOKEN" ] || { echo "set VAGRANT_CLOUD_TOKEN for headless login" >&2; exit 1; }
vagrant cloud auth login --token "$VAGRANT_CLOUD_TOKEN" Prevention
- Create a dedicated access token for CI instead of username/password with 2FA.
- Confirm the account's 2FA delivery method (SMS vs email) before scripting logins.
- Store the token via secret management, not in the Vagrantfile or env files committed to git.
When it happens
Trigger: Running `vagrant cloud auth login` for an account with two-factor authentication enabled; the client detects 2FA is required and calls request_code('sms') or request_code('email') before prompting for the code.
Common situations: First login on a new machine/CI runner with a 2FA-protected Vagrant Cloud account; users surprised a code arrives by SMS when they expected email (delivery method chosen by account settings); retrying login after a wrong code.
Related errors
- Saving box information...
- You are about to publish a box on Vagrant Cloud with the fol
- This command was not invoked properly. The help for this com
- This command was not invoked properly. The help for this com
- This command was not invoked properly. The help for this com
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/a2248c360f7ccd44.
Report an issue: GitHub.