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

The ConfigValidate middleware runs `machine.config.validate` before machine actions and raises ConfigInvalid with a rendered list of every validation error when any exist. These errors come from Vagrantfile config classes (vm, ssh, network) and from provider plugin settings, so the message is an aggregate report of everything wrong with your Vagrantfile.

Source

Thrown at lib/vagrant/action/builtin/config_validate.rb:21

require "vagrant/util/template_renderer"

module Vagrant
  module Action
    module Builtin
      # This class validates the configuration and raises an exception
      # if there are any validation errors.
      class ConfigValidate
        def initialize(app, env)
          @app = app
        end

        def call(env)
          if !env.key?(:config_validate) || env[:config_validate]
            errors = env[:machine].config.validate(env[:machine], env[:ignore_provider])

            if errors && !errors.empty?
              raise Errors::ConfigInvalid,
                errors: Util::TemplateRenderer.render(
                  "config/validation_failed",
                  errors: errors)
            end
          end

          @app.call(env)
        end
      end
    end
  end
end

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Read the enumerated errors in the message; each names the config key and the problem — fix them one by one in the Vagrantfile.
  2. Run `vagrant validate` (add `--ignore-provider` to skip provider checks) to re-check without attempting an up.
  3. If the error is from a provider section, confirm that provider plugin is installed (`vagrant plugin list`) and its version matches the option you used.

Example fix

# before
config.vm.network "forwarded_port", guest: "80", host: 8080  # guest as string + later collision

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

Strategy: validation

Validate before calling

# Fail fast on Vagrantfile problems before any expensive action
vagrant validate --ignore-provider || exit 1
vagrant up

Prevention

When it happens

Trigger: Any machine action (up, reload, provision, destroy, ssh, package...) when the merged Vagrantfile validation returns errors (lib/vagrant/action/builtin/config_validate.rb:15-23). Examples: invalid forwarded-port numbers, private_key_path pointing at a missing file, unknown network options, provider-specific keys failing the provider's own validate hook.

Common situations: Typo'd option names or string/int mixups after copy-pasting Vagrantfile snippets; upgrading Vagrant or a provider plugin where an option became invalid; environment-specific paths (keys, synced folder paths) that exist on one machine but not another.

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/105f96fe0eff8c0a. Report an issue: GitHub.