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

There are errors in the configuration of this machine. Pleas

Error message

There are errors in the configuration of this machine. Please fix
the following errors and try again:

%{errors}

What it means

Raised as Vagrant::Errors::ConfigInvalid from Vagrant::Environment#process_configured_plugins (lib/vagrant/environment.rb:1016) when vagrantfile.config.vagrant.validate(nil) — validation of the root `config.vagrant` settings — returns errors. The failing keys are rendered through the config/validation_failed template into the %{errors} placeholder and environment creation aborts before local plugin processing.

Source

Thrown at lib/vagrant/environment.rb:1016

        ldp = @local_data_path.join("machines/#{mname}/#{provider}") if @local_data_path
        plugins << vagrantfile.machine_config(mname, provider, boxes, ldp, false)[:config]
      end
      result = plugins.reverse.inject(Vagrant::Util::HashWithIndifferentAccess.new) do |memo, val|
        Vagrant::Util::DeepMerge.deep_merge(memo, val.vagrant.plugins)
      end
      Vagrant::Util::DeepMerge.deep_merge(result, vagrantfile.config.vagrant.plugins)
    end

    # Check for any local plugins defined within the Vagrantfile. If
    # found, validate they are available. If they are not available,
    # request to install them, or raise an exception
    #
    # @return [Hash] plugin list for loading
    def process_configured_plugins
      return if !Vagrant.plugins_enabled?
      errors = vagrantfile.config.vagrant.validate(nil)
      if !Array(errors["vagrant"]).empty?
        raise Errors::ConfigInvalid,
          errors: Util::TemplateRenderer.render(
            "config/validation_failed",
            errors: {vagrant: errors["vagrant"]}
          )
      end
      # Check if defined plugins are installed
      installed = Plugin::Manager.instance.installed_plugins
      needs_install = []
      config_plugins = find_configured_plugins
      config_plugins.each do |name, info|
        if !installed[name]
          needs_install << name
        end
      end
      if !needs_install.empty?
        ui.warn(I18n.t("vagrant.plugins.local.uninstalled_plugins",
          plugins: needs_install.sort.join(", ")))
        if !Vagrant.auto_install_local_plugins?

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Read the rendered validation errors in the message — they name the exact offending config.vagrant keys
  2. Fix the plugins entry shape: an Array of names or a Hash keyed by plugin name with optional version/sources/entry_point options
  3. If config.vagrant.host is the culprit, remove it (autodetect) or use a registered host symbol
  4. Re-check with `vagrant validate` after the edit

Example fix

# before
Vagrant.configure("2") do |config|
  config.vagrant.plugins = "vagrant-cachier"   # String, not Array/Hash
end

# after
Vagrant.configure("2") do |config|
  config.vagrant.plugins = { "vagrant-cachier" => { "version" => "1.2.9" } }
end
Defensive patterns

Strategy: validation

Validate before calling

# `vagrant validate` runs the same root-config validation
system("vagrant validate") or abort "invalid config.vagrant settings — see errors above"

Try / catch

begin
  env = Vagrant::Environment.new(cwd: dir)
rescue Vagrant::Errors::ConfigInvalid => e
  abort "Fix config.vagrant settings:\n#{e.extra_data[:errors]}"
end

Prevention

When it happens

Trigger: Malformed root config in the Vagrantfile, most often the plugins entry: assigning a bare string instead of a hash/array (config.vagrant.plugins = "name"), hash entries missing the plugin name, or an invalid config.vagrant.host value — anything the root vagrant config object's validator rejects.

Common situations: Enabling local plugins with syntax copied from a different Vagrant version's docs; hand-merging Vagrantfiles and mangling the config.vagrant section; typos in the plugins hash keys.

Understand the failure class

Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.

Related errors


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