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
- Point `config.vm.clone` at the root directory of an existing Vagrant project (the directory that holds the master Vagrantfile).
- Verify the target: `ls <path>/Vagrantfile` must succeed; prefer `File.expand_path` or absolute paths to avoid cwd-dependent resolution.
- 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
- Use absolute, expand_path'd values for config.vm.clone so the project works from any cwd.
- Add a startup check (Vagrantfile raise or wrapper-script guard) that the clone target contains a Vagrantfile.
- Delete the config.vm.clone line when the master environment is retired.
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
- There are errors in the configuration of this machine. Pleas
- The clone environment hasn't been created yet. To clone from
- There was an error loading a Vagrantfile. The file being loa
- There is a syntax error in the following Vagrantfile. The sy
- There was an error loading a Vagrantfile. The file being loa
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/f9b45aa57e0e5863.
Report an issue: GitHub.