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

The specified Vagrantfile to clone from was not found. Pleas

Error message

The specified Vagrantfile to clone from was not found. Please verify
the `config.vm.clone` setting points to a valid Vagrantfile.

What it means

The prepare_clone middleware handles the legacy `config.vm.clone` setting: it loads the Vagrant environment located at that path. If `clone_env.root_path` is nil — meaning no Vagrantfile was found at the configured path — CloneNotFound is raised before anything is cloned.

Source

Thrown at lib/vagrant/action/builtin/prepare_clone.rb:24

module Vagrant
  module Action
    module Builtin
      class PrepareClone
        def initialize(app, env)
          @app = app
          @logger = Log4r::Logger.new("vagrant::action::vm::prepare_clone")
        end

        def call(env)
          # If we aren't cloning, then do nothing
          if !env[:machine].config.vm.clone
            return @app.call(env)
          end

          # We need to get the machine ID from this Vagrant environment
          clone_env = env[:machine].env.environment(
            env[:machine].config.vm.clone)
          raise Errors::CloneNotFound if !clone_env.root_path

          # Get the machine itself
          clone_machine = clone_env.machine(
            clone_env.primary_machine_name, env[:machine].provider_name)
          raise Errors::CloneMachineNotFound if !clone_machine.id

          # Set the ID of the master so we know what to clone from
          env[:clone_id] = clone_machine.id
          env[:clone_machine] = clone_machine

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

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Point `config.vm.clone` at the root directory of an existing Vagrant project (the directory that holds the master Vagrantfile).
  2. Verify the target: `ls <path>/Vagrantfile` must succeed; prefer `File.expand_path` or absolute paths to avoid cwd-dependent resolution.
  3. If the master environment is gone, remove the `config.vm.clone` line entirely.

Example fix

# before
config.vm.clone = "/home/me/master"        # no Vagrantfile there

# after
config.vm.clone = "/home/me/vagrant-master"  # directory containing a Vagrantfile
Defensive patterns

Strategy: validation

Validate before calling

# Ruby (in a wrapper script): assert the clone source is a real Vagrant env
clone_path = File.expand_path(config_vm_clone_value)
unless File.file?(File.join(clone_path, "Vagrantfile"))
  abort "config.vm.clone target has no Vagrantfile: #{clone_path}"
end

Prevention

When it happens

Trigger: `vagrant up` in a project whose Vagrantfile sets `config.vm.clone = PATH` where PATH is not a directory containing a Vagrantfile (typo, moved/removed directory, or a path pointing at a file) (lib/vagrant/action/builtin/prepare_clone.rb:17-25).

Common situations: Hard-coded absolute clone paths that break when the project moves; relative paths resolving against the wrong cwd; the master project deleted after the clone project was created.

Related errors


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