hashicorp/vagrant · error · Vagrant::Errors::PushStrategyNotDefined
The push strategy '%{name}' is not defined in the Vagrantfil
Error message
The push strategy '%{name}' is not defined in the Vagrantfile. Defined strategy names are: %{pushes} What it means
Raised by `vagrant push <name>` when the requested strategy does not match any `config.push.define` block in the Vagrantfile. validate_pushes! symbolizes the given name and checks membership in the compiled pushes list; on mismatch it raises PushStrategyNotDefined listing every strategy that IS defined. Almost always a typo or a stale command from a different version of the Vagrantfile.
Source
Thrown at plugins/commands/push/command.rb:69
# 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 one of the names listed in the error message (those are the strategies actually defined)
- Open the Vagrantfile and check the exact string in `config.push.define "..."` for spelling, case, and whitespace
- If the name should exist, add the missing `config.push.define` block for it
Example fix
# before config.push.define "ftp" do |push| ... end # vagrant push FTP -> PushStrategyNotDefined (case mismatch) # after # vagrant push ftp -> succeeds
Defensive patterns
Strategy: validation
Validate before calling
blocks = File.readlines('Vagrantfile').select { |l| l.include?('push.define') }
abort "unknown strategy #{name}; defined blocks: #{blocks.join(' | ')}" unless blocks.any? { |b| b.include?(name) }
system("vagrant push #{name}") Try / catch
begin
VagrantPlugins::CommandPush::Command.new([name] + argv, env).execute
rescue Vagrant::Errors::PushStrategyNotDefined => e
warn "#{e.extra_data[:name]} not defined; valid: #{e.extra_data[:pushes].join(', ')}"
exit 1
end Prevention
- Derive the strategy name from the Vagrantfile instead of hardcoding it in scripts
- When renaming a push block, grep CI configs and docs for the old name
- Use lowercase, simple strategy names to avoid case-mismatch failures
When it happens
Trigger: Running e.g. `vagrant push heroku` when the Vagrantfile only defines `ftp` and `local-exec`; invoking with a name whose define block was renamed or removed; calling validate_pushes!(pushes, name) where !pushes.include?(name.to_sym).
Common situations: Renaming a push block in the Vagrantfile while CI still calls the old name; copy-pasting a push command from another project's docs; case mismatches like `vagrant push FTP` because names are compared as exact symbols.
Related errors
- The Vagrantfile defines more than one 'push' strategy. Pleas
- '%{name}' is not a known provisioner. Please specify a valid
- There was an error loading a Vagrantfile. The file being loa
- You requested to remove the box '%{name}' version '%{version
- There are errors in the configuration of this machine. Pleas
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/a252dadfa81babe1.
Report an issue: GitHub.