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

The VM import failed! Try running `VBoxManage import` on the

Error message

The VM import failed! Try running `VBoxManage import` on the box file
manually for more verbose error output.

What it means

After the standard VBoxManage import of the box's .ovf, the Import action checks the returned machine id; a nil id means no VM got registered, so it raises VMImportFailure. The message deliberately points at `VBoxManage import` for the verbose error because Vagrant's progress-wrapped call hides VBoxManage's diagnostics.

Source

Thrown at plugins/providers/virtualbox/action/import.rb:78

              ui.clear_line
              ui.report_progress(progress, 100, false)
            end
          end

          # Set the machine ID
          env[:machine_id] = id
          env[:machine].id = id if !env[:skip_machine]

          # Clear the line one last time since the progress meter doesn't disappear
          # immediately.
          env[:ui].clear_line

          # If we got interrupted, then the import could have been
          # interrupted and its not a big deal. Just return out.
          return if env[:interrupted]

          # Flag as erroneous and return if import failed
          raise Vagrant::Errors::VMImportFailure if !id

          # Import completed successfully. Continue the chain
          @app.call(env)
        end

        def recover(env)
          if env[:machine] && env[:machine].state.id != Vagrant::MachineState::NOT_CREATED_ID
            return if env["vagrant.error"].is_a?(Vagrant::Errors::VagrantError)

            # If we're not supposed to destroy on error then just return
            return if !env[:destroy_on_error]

            # Interrupted, destroy the VM. We note that we don't want to
            # validate the configuration here, and we don't want to confirm
            # we want to destroy.
            destroy_env = env.clone
            destroy_env[:config_validate] = false
            destroy_env[:force_confirm_destroy] = true

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Run the import manually for the verbose error: `VBoxManage import ~/.vagrant.d/boxes/<box>/<ver>/virtualbox/box.ovf`
  2. Re-download and re-add the box (`vagrant box remove <box>` then `vagrant box add`) in case of a truncated archive
  3. Upgrade VirtualBox on the host so the appliance's hardware version is supported
  4. Free disk space and ensure the default machine folder path is plain ASCII with write permission

Example fix

# diagnose (as the error suggests):
# VBoxManage import "$HOME/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-jammy/1.0/virtualbox/box.ovf"
# typical output fix example -- hardware version too new:
# VBoxManage import box.ovf --options ImportNoNAT   # or upgrade VirtualBox
# then: vagrant destroy -f && vagrant up
Defensive patterns

Strategy: try-catch

Validate before calling

# validate the box appliance before a long CI run
ovf = Dir[File.expand_path('~/.vagrant.d/boxes/<box>/<ver>/virtualbox/*.ovf')].first
raise 'box ovf missing' unless ovf
ok = system("VBoxManage import '#{ovf}' --dry-run", out: File::NULL, err: File::NULL)
raise 'VBoxManage cannot import this box - check version/disk space' unless ok

Try / catch

begin
  env.cli('up')
rescue Vagrant::Errors::VMImportFailure => e
  warn e.message  # points at manual `VBoxManage import` for verbose output
  run_manual_import_and_capture_log(Dir[box_dir + '/*.ovf'].first)
end

Prevention

When it happens

Trigger: `vagrant up` on VirtualBox where driver.import completes without an id: corrupted/incompatible .ovf/.ova in the box, VirtualBox version refusing the appliance (hardware version, cloud profiles), disk space or path issues, or the import process killed mid-way (though env[:interrupted] returns earlier for Ctrl-C).

Common situations: Box built with a much newer VirtualBox (higher hardware version) than the host runs; truncated box download; disk full at the default machine folder; VirtualBox 6.x/7.x refusing older OVFs with strict validation; non-ASCII paths breaking the import.

Related errors


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