hashicorp/vagrant · error · Vagrant::Errors::ConfigUpgradeErrors

Because there were errors upgrading your Vagrantfiles, Vagra

Error message

Because there were errors upgrading your Vagrantfiles, Vagrant
can no longer continue. Please fix the errors above and try again.

What it means

Raised while loading a Vagrantfile when an old config version had to be auto-upgraded to the current schema and the upgraded result still fails validation. Vagrant renders all warnings and errors via the config/messages template, prints them as part of the config upgrade output, and then aborts with this error because hard validation errors remain. The detailed per-error reasons appear in the output just above this message.

Source

Thrown at lib/vagrant/vagrantfile.rb:72

      config_warnings = results[:config_warnings]
      provider_cls    = results[:provider_cls]
      provider_options = results[:provider_options]

      # If there were warnings or errors we want to output them
      if !config_warnings.empty? || !config_errors.empty?
        # The color of the output depends on whether we have warnings
        # or errors...
        level  = config_errors.empty? ? :warn : :error
        output = Util::TemplateRenderer.render(
          "config/messages",
          warnings: config_warnings,
          errors: config_errors).chomp
        env.ui.send(level, I18n.t("vagrant.general.config_upgrade_messages",
                               name: name,
                               output: output))

        # If we had errors, then we bail
        raise Errors::ConfigUpgradeErrors if !config_errors.empty?
      end

      # Get the provider configuration from the final loaded configuration
      provider_config = config.vm.get_provider_config(provider)

      # Create machine data directory if it doesn't exist
      # XXX: Permissions error here.
      FileUtils.mkdir_p(data_path)

      # Create the machine and cache it for future calls. This will also
      # return the machine from this method.
      return Machine.new(name, provider, provider_cls, provider_config,
        provider_options, config, data_path, box, env, self)
    end
    # Returns the configuration for a single machine.
    #
    # When loading a box Vagrantfile, it will be prepended to the
    # key order specified when initializing this class. Sub-machine

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Read the validation errors printed just above the message and fix each one in the Vagrantfile
  2. Replace removed 1.x syntax, e.g. `config.vm.forward_port 80, 8080` with `config.vm.network "forwarded_port", guest: 80, host: 8080`
  3. Run `vagrant validate` after edits to confirm the file loads cleanly
  4. Check the release/upgrading notes for your Vagrant version for renamed or removed settings

Example fix

# before (Vagrant 1.x-style Vagrantfile)
config.vm.forward_port 80, 8080

# after
config.vm.network "forwarded_port", guest: 80, host: 8080
Defensive patterns

Strategy: validation

Validate before calling

# bash CI gate: fail fast on invalid Vagrantfiles before any vagrant command
vagrant validate || exit 1

Try / catch

begin
  env = Vagrant::Environment.new(cwd: project_dir)
  env.cli(%w(up))
rescue Vagrant::Errors::ConfigUpgradeErrors
  warn 'Vagrantfile failed the config upgrade; run `vagrant validate` and fix the listed errors'
  exit 1
end

Prevention

When it happens

Trigger: Loading an environment (any `vagrant up`/`ssh`/`status`, or Environment#machine_config) whose Vagrantfile was written for an older config version - e.g. Vagrant 1.x-era keys like `config.vm.forward_port` - after upgrading the Vagrant binary, where the upgraded config no longer validates.

Common situations: Major-version Vagrant upgrade against legacy Vagrantfiles checked into a repo; plugins injecting settings that are invalid under the new config version; CI images rebuilt with a newer Vagrant running against an old project.

Related errors


AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21). Data as JSON: /api/errors/256fa5755fe3e8cc. Report an issue: GitHub.