{"record":{"id":"d9018ad97a24aa94","repo":"hashicorp/vagrant","slug":"creation-of-the-linked-clone-failed","errorCode":null,"errorMessage":"Creation of the linked clone failed.","messagePattern":"Creation of the linked clone failed\\.","errorType":"exception","errorClass":"Vagrant::Errors::VMCloneFailure","httpStatus":null,"severity":"error","filePath":"plugins/providers/virtualbox/action/import.rb","lineNumber":36,"sourceCode":"        end\n\n        def clone(env)\n          # Do the actual clone\n          env[:ui].info I18n.t(\"vagrant.actions.vm.clone.creating\")\n          env[:machine].id = env[:machine].provider.driver.clonevm(\n            env[:clone_id], env[:clone_snapshot]) do |progress|\n            env[:ui].rewriting do |ui|\n              ui.clear_line\n              ui.report_progress(progress, 100, false)\n            end\n          end\n\n          # Clear the line one last time since the progress meter doesn't\n          # disappear immediately.\n          env[:ui].clear_line\n\n          # Flag as erroneous and return if clone failed\n          raise Vagrant::Errors::VMCloneFailure if !env[:machine].id\n\n          # Copy the SSH key from the clone machine if we can\n          if env[:clone_machine]\n            key_path = env[:clone_machine].data_dir.join(\"private_key\")\n            if key_path.file?\n              FileUtils.cp(\n                key_path,\n                env[:machine].data_dir.join(\"private_key\"))\n            end\n          end\n\n          # Continue\n          @app.call(env)\n        end\n\n        def import(env)\n          env[:ui].info I18n.t(\"vagrant.actions.vm.import.importing\",\n                               name: env[:machine].box.name)","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/providers/virtualbox/action/import.rb#L18-L54","documentation":"When linked_clone is enabled, the Import action clones the master VM/snapshot via driver.import.clone (passing env[:clone_id] and env[:clone_snapshot]) and then checks env[:machine].id. A nil id means the clone produced no registered machine, so Vagrant raises VMCloneFailure — the linked-clone path did not yield a usable VM.","triggerScenarios":"`vagrant up` with provider config `linked_clone: true` where the clone/import call returns without an id: master VM or its snapshot missing/corrupt, VirtualBox failing the differencing-disk creation silently, or disk space exhaustion during the clone.","commonSituations":"The master VM recorded in ~/.vagrant.d/boxes/.../clone_id was deleted from VirtualBox while the id file remained; VirtualBox upgraded and differencing disks broke; host disk full; snapshot the master was pinned to was removed.","solutions":["Retry once after `vagrant destroy -f` of the half-created machine, to rule out a transient VirtualBox failure","Disable linked clones: set `config.vm.provider 'virtualbox' { |vb| vb.linked_clone = false }` and `vagrant up` again (full clone/import path)","Remove and re-add the box so the master VM and its snapshot are re-imported cleanly (deletes stale clone_id files)","Free disk space on the host and check `VBoxManage list vms` for the master; run the clone manually with VBoxManage for verbose output if it persists"],"exampleFix":"# Vagrantfile - before:\nconfig.vm.provider 'virtualbox' do |vb|\n  vb.linked_clone = true\nend\n\n# after (workaround while master/snapshot is broken):\nconfig.vm.provider 'virtualbox' do |vb|\n  vb.linked_clone = false\nend\n# plus: vagrant box remove <box> && vagrant box add <box> to rebuild the master","handlingStrategy":"fallback","validationCode":"# sanity-check the linked-clone master before up\nid_file = File.expand_path('~/.vagrant.d/boxes/<box>/<ver>/virtualbox/clone_id')\nif File.file?(id_file)\n  master = File.read(id_file).chomp\n  exists = `VBoxManage list vms`.include?(\"#{master} \")\n  warn 'Master VM missing - linked clone will fail; re-add box' unless exists\nend","typeGuard":null,"tryCatchPattern":"begin\n  env.cli('up')\nrescue Vagrant::Errors::VMCloneFailure\n  # fall back to full import: linked clone master/snapshot is unusable\n  patch_vagrantfile('vb.linked_clone = false')\n  retry\nend","preventionTips":["Re-add boxes after major VirtualBox upgrades so master VMs/snapshots stay consistent","Monitor host disk space — clone failures often stem from exhausted storage","Keep `linked_clone = false` in throwaway CI where isolation matters more than speed"],"tags":["virtualbox","linked-clone","import","snapshot"],"backgroundTag":"clone-operation-failed","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}