hashicorp/vagrant · warning

Machine '%{name}' has not been created yet, and therefore ca

Error message

Machine '%{name}' has not been created yet, and therefore cannot save snapshots. Skipping...

What it means

While `vagrant snapshot save` iterates target VMs, any machine whose vm.id is nil (never created, no entry in .vagrant) cannot take snapshots. That machine is named in this warning and skipped; remaining created machines still receive the snapshot and the command succeeds.

Source

Thrown at plugins/commands/snapshot/command/save.rb:51

          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

            # In this case, no vm name was given, and we are iterating over the
            # entire environment. If a vm hasn't been created yet, we can't list
            # its snapshots
            if vm.id.nil?
              @env.ui.warn(I18n.t("vagrant.commands.snapshot.save.vm_not_created",
                                  name: vm.name))
              next
            end

            snapshot_list = vm.provider.capability(:snapshot_list)

            if !snapshot_list.include? name
              vm.action(:snapshot_save, snapshot_name: name)
            elsif options[:force]
              # not a unique snapshot name
              vm.action(:snapshot_delete, snapshot_name: name)
              vm.action(:snapshot_save, snapshot_name: name)
            else
              raise Vagrant::Errors::SnapshotConflictFailed
            end
          end

          # Success, exit status 0

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Create the machine first with `vagrant up <name>`, then re-run the snapshot
  2. Target only the created machines: `vagrant snapshot save my_snap web db`
  3. Accept the skip if intended — created machines are snapshotted and the command exits 0

Example fix

# before
vagrant snapshot save snap1           # warns for not-created machines
# after
vagrant snapshot save snap1 web db     # only existing machines
Defensive patterns

Strategy: validation

Validate before calling

# Check machine state before snapshotting
vagrant status --machine-readable | grep ',state,' | grep -v ',not_created,'

Type guard

def machine_created?(machine)
  !machine.id.nil? && machine.state.id != :not_created
end

Prevention

When it happens

Trigger: `vagrant snapshot save my_snap` with no machine name, so with_target_vms iterates the entire environment while at least one machine has vm.id nil — e.g. a fresh checkout without `vagrant up`, or after destroying one machine of a multi-machine environment.

Common situations: Partially-up environments; running snapshot save right after destroying one node; CI runs against a clean project state.

Related errors


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