hashicorp/vagrant · error · Vagrant::Errors::UploaderError
An error occurred while uploading the file. The error messag
Error message
An error occurred while uploading the file. The error
message, if any, is reproduced below. Please fix this error and try
again.
exit code: %{exit_code}
%{message} What it means
Raised by Vagrant::Util::Uploader after the underlying curl process it shells out to (Subprocess.execute("curl", ...)) exits with a non-zero status. The uploader is used for file uploads such as publishing boxes to Vagrant Cloud, and before raising it parses stderr for curl's '(code) message' pattern, falling back to raw stderr text when no match is found. The rendered message embeds both the curl exit code and that parsed text, so the actionable detail comes from curl itself.
Source
Thrown at lib/vagrant/util/uploader.rb:94
result = Busy.busy(int_callback) do
Subprocess.execute("curl", *options, &data_proc)
end
# If the upload was interrupted, then raise a specific error
raise Errors::UploaderInterrupted 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("Uploader exit code: #{result.exit_code}")
check = result.stderr.match(/\n*curl:\s+\((?<code>\d+)\)\s*(?<error>.*)$/)
if !check
err_msg = result.stderr
else
err_msg = check[:error]
end
raise Errors::UploaderError,
exit_code: result.exit_code,
message: err_msg
end
if @ui
@ui.clear_line
# Windows doesn't clear properly for some reason, so we just
# output one more newline.
@ui.detail("") if Platform.windows?
end
result
end
end
end
end
View on GitHub (pinned to 35f3160f4a)
Solutions
- Read the embedded curl message and exit code - `curl: (22) ... 401` points at auth, `(7) Failed to connect` at network, `(60) SSL certificate problem` at TLS interception
- If it is an auth failure, refresh credentials with `vagrant cloud auth login` and retry the upload
- Reproduce outside Vagrant with `curl -v -T <file> <url>` to see the raw HTTP/TLS exchange
- Check and (if wrong) unset or fix proxy environment variables (http_proxy, https_proxy, no_proxy)
- Retry once transient causes (timeout, connection reset) are ruled out or resolved
Example fix
# before vagrant cloud publish myuser/mybox 1.0.0 virtualbox package.box # -> error, curl message shows: curl: (22) The requested URL returned error: 401 # after vagrant cloud auth login # or: export VAGRANT_CLOUD_TOKEN=... vagrant cloud publish myuser/mybox 1.0.0 virtualbox package.box
Defensive patterns
Strategy: try-catch
Validate before calling
# bash: verify cloud session + endpoint before a long publish
vagrant cloud auth whoami >/dev/null 2>&1 || vagrant cloud auth login
curl -fsSI -o /dev/null https://app.vagrantup.com/ || { echo 'upload endpoint unreachable'; exit 1; } Try / catch
begin Vagrant::Util::Uploader.new(ui, url, uploader_options).upload! rescue Vagrant::Errors::UploaderError => e code = e.extra_data[:exit_code].to_i retry if [28, 56].include?(code) # transient curl timeout / recv reset: retry once raise # auth (22/401), TLS (60), connect (7): surface to caller end
Prevention
- Run `vagrant cloud auth login` or set VAGRANT_CLOUD_TOKEN before scripted publishes
- Smoke-test connectivity to the upload host with `curl -I` in CI before the long upload
- Verify http_proxy/https_proxy/no_proxy in CI jobs point at a live proxy
- Keep curl on PATH and reasonably recent - the uploader shells out to it directly
When it happens
Trigger: Any code path that uses the Uploader utility - chiefly `vagrant cloud publish` / box upload flows - where curl fails: HTTP 401/403 from an expired or missing cloud token, curl exit 7 (connection failed), exit 6 (DNS), exit 28 (timeout), exit 55/56 (send/recv errors), or exit 60 (TLS certificate verification failure).
Common situations: Expired or missing Vagrant Cloud token; corporate proxy or TLS-intercepting firewall breaking curl; unreachable upload endpoint; redirect loops; http_proxy/https_proxy environment variables pointing at a dead proxy in CI runners.
Related errors
- The upload was interrupted by an external signal. It did not
- An error occurred while downloading the remote file. The err
- The Vagrant Cloud server is not currently accepting connecti
- This command was not invoked properly. The help for this com
- Vagrant is automatically disabling direct upload to backend
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/2165aa4ed206d385.
Report an issue: GitHub.