{"record":{"id":"f9b45aa57e0e5863","repo":"hashicorp/vagrant","slug":"the-specified-vagrantfile-to-clone-from-was-not-fo","errorCode":null,"errorMessage":"The specified Vagrantfile to clone from was not found. Please verify\nthe `config.vm.clone` setting points to a valid Vagrantfile.","messagePattern":"The specified Vagrantfile to clone from was not found\\. Please verify\nthe `config\\.vm\\.clone` setting points to a valid Vagrantfile\\.","errorType":"exception","errorClass":"Vagrant::Errors::CloneNotFound","httpStatus":null,"severity":"error","filePath":"lib/vagrant/action/builtin/prepare_clone.rb","lineNumber":24,"sourceCode":"module Vagrant\n  module Action\n    module Builtin\n      class PrepareClone\n        def initialize(app, env)\n          @app = app\n          @logger = Log4r::Logger.new(\"vagrant::action::vm::prepare_clone\")\n        end\n\n        def call(env)\n          # If we aren't cloning, then do nothing\n          if !env[:machine].config.vm.clone\n            return @app.call(env)\n          end\n\n          # We need to get the machine ID from this Vagrant environment\n          clone_env = env[:machine].env.environment(\n            env[:machine].config.vm.clone)\n          raise Errors::CloneNotFound if !clone_env.root_path\n\n          # Get the machine itself\n          clone_machine = clone_env.machine(\n            clone_env.primary_machine_name, env[:machine].provider_name)\n          raise Errors::CloneMachineNotFound if !clone_machine.id\n\n          # Set the ID of the master so we know what to clone from\n          env[:clone_id] = clone_machine.id\n          env[:clone_machine] = clone_machine\n\n          # Continue\n          @app.call(env)\n        end\n      end\n    end\n  end\nend\n","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/lib/vagrant/action/builtin/prepare_clone.rb#L6-L42","documentation":"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.","triggerScenarios":"`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).","commonSituations":"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.","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."],"exampleFix":"# before\nconfig.vm.clone = \"/home/me/master\"        # no Vagrantfile there\n\n# after\nconfig.vm.clone = \"/home/me/vagrant-master\"  # directory containing a Vagrantfile","handlingStrategy":"validation","validationCode":"# Ruby (in a wrapper script): assert the clone source is a real Vagrant env\nclone_path = File.expand_path(config_vm_clone_value)\nunless File.file?(File.join(clone_path, \"Vagrantfile\"))\n  abort \"config.vm.clone target has no Vagrantfile: #{clone_path}\"\nend","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["vagrant","clone","vagrantfile"],"backgroundTag":"path-not-found","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}