{"record":{"id":"3720ab2f4db86493","repo":"hashicorp/vagrant","slug":"the-vagrantfile-defines-more-than-one-push-strat","errorCode":null,"errorMessage":"The Vagrantfile defines more than one 'push' strategy. Please specify a strategy. Defined strategy names are: %{pushes}","messagePattern":"The Vagrantfile defines more than one 'push' strategy\\. Please specify a strategy\\. Defined strategy names are: %(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::PushStrategyNotProvided","httpStatus":null,"severity":"error","filePath":"plugins/commands/push/command.rb","lineNumber":62,"sourceCode":"      #\n      # @param [Array<Symbol>] pushes\n      #   the list of pushes defined by the environment\n      # @param [String] name\n      #   the name provided by the user on the command line\n      #\n      # @return [Symbol]\n      #   the compiled list of pushes\n      #\n      def validate_pushes!(pushes, name = nil)\n        if pushes.nil? || pushes.empty?\n          raise Vagrant::Errors::PushesNotDefined\n        end\n\n        if name.nil?\n          if pushes.length == 1\n            return pushes.first.to_sym\n          else\n            raise Vagrant::Errors::PushStrategyNotProvided,\n              pushes: pushes.map(&:to_s)\n          end\n        end\n\n        name = name.to_sym\n        if !pushes.include?(name)\n          raise Vagrant::Errors::PushStrategyNotDefined,\n            name: name.to_s,\n            pushes: pushes.map(&:to_s)\n        end\n\n        return name\n      end\n    end\n  end\nend\n","sourceCodeStart":44,"sourceCodeEnd":79,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/commands/push/command.rb#L44-L79","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nconfig.push.define('ftp') do |push| ... end\nconfig.push.define('local-exec') do |push| ... end\n# vagrant push  ->  PushStrategyNotProvided\n\n# after\n# vagrant push ftp    (or)    vagrant push local-exec","handlingStrategy":"validation","validationCode":"defined = File.readlines('Vagrantfile').count { |l| l.include?('push.define') }\nabort 'multiple push strategies defined; run: vagrant push <name>' if defined > 1\nsystem('vagrant push')","typeGuard":null,"tryCatchPattern":"begin\n  VagrantPlugins::CommandPush::Command.new(argv, env).execute\nrescue Vagrant::Errors::PushStrategyNotProvided => e\n  names = e.extra_data[:pushes]\n  raise \"specify one of: #{names.join(', ')}\"\nend","preventionTips":["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"],"tags":["vagrant","push","cli","vagrantfile","configuration"],"backgroundTag":"ambiguous-command-target","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}