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

An error occurred while downloading the remote file. The err

Error message

An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

%{message}

What it means

Raised by Vagrant::Util::Downloader when curl exits non-zero and the parsed stderr code is not 416 (416 = requested range already satisfied, treated as success). The %{message} carries the curl exit code plus the parsed `curl: (code) error` line, or raw stderr when unparsable, so the exact curl objection is visible.

Source

Thrown at lib/vagrant/util/downloader.rb:227

        # If the download was interrupted, then raise a specific error
        raise Errors::DownloaderInterrupted if interrupted

        # If it didn't exit successfully, we need to parse the data and
        # show an error message.
        if result.exit_code != 0
          @logger.warn("Downloader exit code: #{result.exit_code}")
          check = result.stderr.match(/\n*curl:\s+\((?<code>\d+)\)\s*(?<error>.*)$/)
          if check && check[:code] == "416"
            # All good actually. 416 means there is no more bytes to download
            @logger.warn("Downloader got a 416, but is likely fine. Continuing on...")
          else
            if !check
              err_msg = result.stderr
            else
              err_msg = check[:error]
            end

            raise Errors::DownloaderError,
              code: result.exit_code,
              message: err_msg
          end
        end

        result
      end

      # Returns the various cURL and subprocess options.
      #
      # @return [Array<Array, Hash>]
      def options
        # Build the list of parameters to execute with cURL
        options = [
          "--fail",
          "--location",
          "--max-redirs", "10", "--verbose",
          "--user-agent", USER_AGENT,

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Read %{message} and map the curl code: 6=DNS, 7=connect, 22=HTTP 4xx/5xx (fix the URL), 35/60=TLS/CA, 5=proxy resolution
  2. Reproduce outside Vagrant: `curl -fIL <box_url>` to confirm the failure mode
  3. Fix the source: update the renamed/removed box URL or regenerate the expired signed link
  4. For TLS/proxy issues, install the full CA bundle in the environment running vagrant and set correct http_proxy/https_proxy/no_proxy

Example fix

# before
config.vm.box_url = "https://vagrantcloud.com/myuser/old-box-name"

# after (box was renamed upstream)
config.vm.box_url = "https://vagrantcloud.com/myuser/new-box-name"
Defensive patterns

Strategy: retry

Validate before calling

require 'uri'

begin
  u = URI.parse(url)
  raise unless u.is_a?(URI::HTTP) || u.is_a?(URI::FTP)
rescue
  abort "bad box_url: #{url}"
end

# reachability probe before handing off to Vagrant
system('curl', '-fsIL', url, out: File::NULL) or abort 'URL not reachable'

Try / catch

begin
  downloader.download!
rescue Vagrant::Errors::DownloaderError => e
  fatal = e.message.include?('(22)') # HTTP 4xx/5xx — retry will not help
  retry unless fatal
  abort e.message
end

Prevention

When it happens

Trigger: `vagrant box add` / box_download where the URL returns 404/403, DNS fails (code 6), connection refused (7), TLS verification fails (35/60), a proxy blocks the transfer via http_proxy/https_proxy, or a signed URL expired — any curl failure except a clean 416.

Common situations: Stale box_url in a Vagrantfile after the box was renamed or removed from Vagrant Cloud; corporate TLS-intercepting proxies with missing CA bundles; self-hosted artifact servers with expired tokens; typo'd URLs.

Related errors


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