hashicorp/vagrant · error · Vagrant::Errors::PushStrategyNotProvided
The Vagrantfile defines more than one 'push' strategy. Pleas
Error message
The Vagrantfile defines more than one 'push' strategy. Please specify a strategy. Defined strategy names are: %{pushes} What it means
Raised by `vagrant push` when the Vagrantfile defines more than one `config.push.define` block but no strategy name was given on the command line. The command's validate_pushes! auto-selects a strategy only when exactly one is defined; with two or more it raises PushStrategyNotProvided and interpolates the defined names into the message. This is a usage/validation error, not a failure of any push backend.
Source
Thrown at plugins/commands/push/command.rb:62
#
# @param [Array<Symbol>] pushes
# the list of pushes defined by the environment
# @param [String] name
# the name provided by the user on the command line
#
# @return [Symbol]
# the compiled list of pushes
#
def validate_pushes!(pushes, name = nil)
if pushes.nil? || pushes.empty?
raise Vagrant::Errors::PushesNotDefined
end
if name.nil?
if pushes.length == 1
return pushes.first.to_sym
else
raise Vagrant::Errors::PushStrategyNotProvided,
pushes: pushes.map(&:to_s)
end
end
name = name.to_sym
if !pushes.include?(name)
raise Vagrant::Errors::PushStrategyNotDefined,
name: name.to_s,
pushes: pushes.map(&:to_s)
end
return name
end
end
end
end
View on GitHub (pinned to 35f3160f4a)
Solutions
- Re-run with an explicit strategy: `vagrant push <name>` using one of the names listed in the error message
- Delete or comment out push blocks you do not use so exactly one remains and the bare `vagrant push` works again
- If multiple strategies are intentional, update scripts/CI to always pass the strategy name explicitly
Example fix
# before
config.push.define('ftp') do |push| ... end
config.push.define('local-exec') do |push| ... end
# vagrant push -> PushStrategyNotProvided
# after
# vagrant push ftp (or) vagrant push local-exec Defensive patterns
Strategy: validation
Validate before calling
defined = File.readlines('Vagrantfile').count { |l| l.include?('push.define') }
abort 'multiple push strategies defined; run: vagrant push <name>' if defined > 1
system('vagrant push') Try / catch
begin
VagrantPlugins::CommandPush::Command.new(argv, env).execute
rescue Vagrant::Errors::PushStrategyNotProvided => e
names = e.extra_data[:pushes]
raise "specify one of: #{names.join(', ')}"
end Prevention
- Always pass an explicit strategy name to `vagrant push` when more than one `config.push.define` block exists
- Keep one push strategy per Vagrantfile unless deployment targets genuinely differ
- Script push invocations so CI always includes the strategy name
When it happens
Trigger: Running `vagrant push` with no strategy argument while the Vagrantfile contains multiple push blocks (e.g. both `config.push.define 'ftp'` and `config.push.define 'local-exec'`). Programmatically, calling validate_pushes!(pushes) with a pushes array of length > 1 and name = nil.
Common situations: A team Vagrantfile keeps separate push strategies for staging and production; a developer who previously used a single-push Vagrantfile copies in a second block and re-runs the bare `vagrant push` command they had aliased or scripted.
Related errors
- The push strategy '%{name}' is not defined in the Vagrantfil
- There are errors in the configuration of this machine. Pleas
- There was an error loading a Vagrantfile. The file being loa
- There was an error loading a Vagrantfile. The file being loa
- The push strategy '%{name}' is not defined in the Vagrantfil
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/3720ab2f4db86493.
Report an issue: GitHub.