{"record":{"id":"37c9af6d633dcc34","repo":"hashicorp/vagrant","slug":"vagrant-cap-configure-disks-recovery-from-resize","errorCode":null,"errorMessage":"vagrant.cap.configure_disks.recovery_from_resize","messagePattern":"vagrant\\.cap\\.configure_disks\\.recovery_from_resize","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/providers/virtualbox/cap/configure_disks.rb","lineNumber":375,"sourceCode":"              machine.provider.driver.remove_disk(controller.name, defined_disk[:port], defined_disk[:device])\n              # Create a backup of the original disk if something goes wrong\n              LOGGER.warn(\"Making a backup of the original disk at #{defined_disk[:location]}\")\n              FileUtils.mv(defined_disk[:location], backup_disk_location)\n\n              # we have to close here, otherwise we can't re-clone after\n              # resizing the vdi disk\n              machine.provider.driver.close_medium(defined_disk[:uuid])\n\n              # clone back to original vmdk format and attach resized disk\n              vmdk_disk_file = machine.provider.driver.vdi_to_vmdk(vdi_disk_file)\n              machine.provider.driver.attach_disk(controller.name,\n                                                  defined_disk[:port],\n                                                  defined_disk[:device],\n                                                  \"hdd\",\n                                                  vmdk_disk_file)\n            rescue ScriptError, SignalException, StandardError\n              LOGGER.warn(\"Vagrant encountered an error while trying to resize a disk. Vagrant will now attempt to reattach and preserve the original disk...\")\n              machine.ui.error(I18n.t(\"vagrant.cap.configure_disks.recovery_from_resize\",\n                                      location: original_disk[:location],\n                                      name: machine.name))\n              recover_from_resize(machine, defined_disk, backup_disk_location, original_disk, vdi_disk_file, controller)\n              raise\n            ensure\n              # Remove backup disk file if all goes well\n              FileUtils.remove(backup_disk_location, force: true)\n            end\n\n            # Remove cloned resized volume format\n            machine.provider.driver.close_medium(vdi_disk_file)\n\n            # Get new updated disk UUID for vagrant disk_meta file\n            storage_controllers = machine.provider.driver.read_storage_controllers\n            updated_controller = storage_controllers.get_controller(controller.name)\n            new_disk_info = updated_controller.attachments.detect { |h| h[:location] == defined_disk[:location] }\n\n            defined_disk = new_disk_info","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/providers/virtualbox/cap/configure_disks.rb#L357-L393","documentation":"Error \"vagrant.cap.configure_disks.recovery_from_resize\" thrown in hashicorp/vagrant.","triggerScenarios":"Thrown at plugins/providers/virtualbox/cap/configure_disks.rb:375 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}