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

No valid IDs were given to the NFS synced folder implementat

Error message

No valid IDs were given to the NFS synced folder implementation to
prune. This is an internal bug with Vagrant and an issue should be
filed.

What it means

cleanup() prunes stale NFS exports using opts[:nfs_valid_ids], which the synced-folder cleanup middleware supplies (machine IDs that still hold NFS folders). If the key is absent, Vagrant raises NFSNoValidIds and the message explicitly calls it an internal bug that should be filed.

Source

Thrown at plugins/synced_folders/nfs/synced_folder.rb:128

          ))
        end

        # Mount them!
        if machine.guest.capability?(:nfs_pre)
          machine.guest.capability(:nfs_pre)
        end

        machine.guest.capability(:mount_nfs_folder,
          nfsopts[:nfs_host_ip], mount_folders)

        if machine.guest.capability?(:nfs_post)
          machine.guest.capability(:nfs_post)
        end
      end

      def cleanup(machine, opts)
        ids = opts[:nfs_valid_ids]
        raise Vagrant::Errors::NFSNoValidIds if !ids

        # Prune any of the unused machines
        @logger.info("NFS pruning. Valid IDs: #{ids.inspect}")
        machine.env.host.capability(:nfs_prune, machine.ui, ids)
      end

      protected

      def prepare_folder(machine, opts)
        opts[:map_uid] = prepare_permission(machine, :uid, opts)
        opts[:map_gid] = prepare_permission(machine, :gid, opts)
        opts[:nfs_version] ||= 3
        if !opts.key?(:nfs_udp)
          opts[:nfs_udp] = !opts[:nfs_version].to_s.start_with?('4')
        end

        if opts[:nfs_version].to_s.start_with?('4') && opts[:nfs_udp]
          machine.ui.info I18n.t("vagrant.actions.vm.nfs.v4_with_udp_warning")

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. File a Vagrant issue with --debug output as the message instructs
  2. Update (or pin away from) the Vagrant version that regressed
  3. Plugin authors: always pass opts[:nfs_valid_ids] when calling cleanup
  4. Workaround: remove stale entries from /etc/exports manually and run exportfs -ra

Example fix

# plugin code
# before
subject.cleanup(machine, {})

# after
subject.cleanup(machine, { nfs_valid_ids: valid_machine_ids })
Defensive patterns

Strategy: try-catch

Validate before calling

# plugin authors: supply valid IDs before cleanup
ids = env[:machine].env.active_machines.map { |m| m[0].to_s }
opts[:nfs_valid_ids] ||= ids

Type guard

def nfs_cleanup_args_valid?(opts)
  !opts[:nfs_valid_ids].nil?
end

Try / catch

begin
  subject.cleanup(machine, opts)
rescue Vagrant::Errors::NFSNoValidIds => e
  # internal bug per the message - collect debug output and file an issue
  report_vagrant_bug("NFSNoValidIds", e)
end

Prevention

When it happens

Trigger: A plugin or custom action invoking SyncedFolderNFS#cleanup without passing nfs_valid_ids, or a core middleware regression that fails to propagate the valid-ID list during destroy/halt/reload paths.

Common situations: Provider/synced-folder plugins hooking cleanup themselves; rare core regressions, usually alongside other middleware failures.

Related errors


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