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

The snapshot name `%{snapshot_name}` was not found for the v

Error message

The snapshot name `%{snapshot_name}` was not found for the virtual machine `%{machine}`.

What it means

`vagrant snapshot delete [vm-name] <name>` could not find the snapshot: the provider's `snapshot_list` capability returned an array that does not include the given name. The command deliberately refuses to invoke the snapshot_delete action on a nonexistent snapshot because providers raise uglier errors in that case.

Source

Thrown at plugins/commands/snapshot/command/delete.rb:38

          argv = parse_options(opts)
          return if !argv
          if argv.empty? || argv.length > 2
            raise Vagrant::Errors::CLIInvalidUsage,
              help: opts.help.chomp
          end

          name = argv.pop
          with_target_vms(argv) do |vm|
            if !vm.provider.capability?(:snapshot_list)
              raise Vagrant::Errors::SnapshotNotSupported
            end

            snapshot_list = vm.provider.capability(:snapshot_list)

            if snapshot_list.include? name
              vm.action(:snapshot_delete, snapshot_name: name)
            else
              raise Vagrant::Errors::SnapshotNotFound,
                snapshot_name: name,
                machine: vm.name.to_s
            end
          end

          # Success, exit status 0
          0
        end
      end
    end
  end
end

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. List what exists with `vagrant snapshot list` (or `vagrant snapshot list <vm-name>`) and copy the exact name
  2. In multi-machine projects, pass the correct vm-name so you target the machine that owns the snapshot
  3. If the snapshot should exist, create it first with `vagrant snapshot save <name>`

Example fix

# before
vagrant snapshot delete pre-migraion   # typo

# after
vagrant snapshot list                   # shows 'pre-migration'
vagrant snapshot delete pre-migration
Defensive patterns

Strategy: validation

Validate before calling

existing = `vagrant snapshot list`.split
abort "snapshot #{name} not found; have: #{existing.join(', ')}" unless existing.include?(name)
system("vagrant snapshot delete #{name}")

Try / catch

begin
  command.execute
rescue Vagrant::Errors::SnapshotNotFound => e
  warn "missing #{e.extra_data[:snapshot_name]} on #{e.extra_data[:machine]}"
  exit 1
end

Prevention

When it happens

Trigger: Deleting a snapshot that was never taken, was already deleted, or differs by case/whitespace; targeting the wrong multi-machine VM (e.g. `vagrant snapshot delete web db_snap` where db_snap belongs to the db machine).

Common situations: Typos in scripted cleanup (`vagrant snapshot delete pre-migraion`); assuming a box ships with snapshots; stale names left in team docs after shared snapshots were deleted.

Related errors


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