hashicorp/vagrant · warning · Vagrant::Errors::BoxAddShortNotFound

The box '%{name}' could not be found or could not be accesse

Error message

The box '%{name}' could not be found or could not be accessed in the remote catalog. 
If this is a private box on the HashiCorp Vagrant Public Registry, please verify 
you're logged in via `vagrant cloud auth login`. Also, please double-check the name. 
The expanded URL and error message are shown below:

URL: %{url}
Error: %{error}

What it means

Emitted from expanded_folders (chef_solo.rb:73-98) during configure: chef_solo expands every host-side path relative to the project root with File.expand_path, and when File.exist? is false it warns e.g. "The cookbook path '%{path}' doesn't exist. Ignoring..." and skips that folder with `next`. The appended_folder argument selects the message key: configure passes "cookbooks", "roles", "data_bags", "environments", "nodes" for the corresponding *_path options (chef_solo.rb:37-41). The chef-solo run continues without the missing folder — a missing cookbooks folder typically makes the actual chef-solo execution fail later when it cannot load recipes.

Source

Thrown at lib/vagrant/action/builtin/box_add.rb:135

          if single_entry && expanded
            idx = is_metadata_results.index { |v| v === true }
            # If none of the urls were successful, set the index
            # as the last entry
            idx = is_metadata_results.size - 1 if idx.nil?

            # Now reset collections with single value
            is_metadata_results = [is_metadata_results[idx]]
            authed_urls = [authed_urls[idx]]
            url = [url[idx]]
          end

          if expanded && url.length == 1
            is_error = is_metadata_results.find do |b|
              b.is_a?(Errors::DownloaderError)
            end

            if is_error
              raise Errors::BoxAddShortNotFound,
                error: is_error.extra_data[:message],
                name: env[:box_url],
                url: url
            end
          end

          is_error = is_metadata_results.find do |b|
            b.is_a?(Errors::DownloaderError)
          end
          if is_error
            raise Errors::BoxMetadataDownloadError,  
              message: is_error.extra_data[:message]
          end

          is_metadata = is_metadata_results.any? { |b| b === true }
          if is_metadata && url.length > 1
            raise Errors::BoxAddMetadataMultiURL,
              urls: url.join(", ")

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Create the missing directory the warning prints — the %{path} in the message is the fully expanded path, so compare it directly with what exists.
  2. Fix the Vagrantfile path: paths are expanded relative to the Vagrantfile's root_path, so prefer repo-relative values like "cookbooks".
  3. If cookbooks come from Berkshelf, run `berks vendor cookbooks` (or use the berkshelf client plugin) before provisioning.
  4. Verify quickly: `ls -d "$(vagrant ssh-config >/dev/null; echo)"` — or simply `File.exist?(File.expand_path(path, project_root))` from Ruby before invoking vagrant.

Example fix

# Vagrantfile — before (typo: cookboks)
config.vm.provision "chef_solo" do |chef|
  chef.cookbooks_path = "cookboks"
  chef.run_list       = ["recipe[motd]"]
end

# after
root = File.dirname(__FILE__)
config.vm.provision "chef_solo" do |chef|
  chef.cookbooks_path = "cookbooks"
  abort "cookbooks missing: #{File.expand_path(chef.cookbooks_path, root)}" unless File.exist?(File.expand_path(chef.cookbooks_path, root))
  chef.run_list = ["recipe[motd]"]
end
Defensive patterns

Strategy: validation

Validate before calling

# Vagrantfile — validate every host-side chef path before `vagrant up`
root = File.dirname(__FILE__)
%w[cookbooks_path roles_path data_bags_path environments_path nodes_path].each do |attr|
  Array(chef.public_send(attr)).each do |entry|
    path = entry.is_a?(Array) ? entry[1] : entry
    next unless path.is_a?(String)
    expanded = File.expand_path(path, root)
    abort "#{attr}: host path not found: #{expanded}" unless File.exist?(expanded)
  end
end

Type guard

def host_chef_path_exists?(path, root_path)
  File.exist?(File.expand_path(path.to_s, root_path))
end

Prevention

When it happens

Trigger: chef_solo (or chef_zero, which shares this provisioner code path via its solo-style folders) with cookbooks_path/roles_path/data_bags_path/environments_path/nodes_path whose :host entry does not exist on the host: typo, directory never created, wrong letter casing on a case-sensitive filesystem, absolute path from another machine, or running vagrant from a different root_path than where the paths resolve.

Common situations: Forgot to clone/vendor cookbooks (berks vendor, knife cookbook site install) before `vagrant up`; path typo like "cookboks"; directory renamed; repo checked out on Linux with "Cookbooks" vs "cookbooks" casing mismatch; Windows-style absolute path (C:\...) used on a macOS/Linux host.

Related errors


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