{"record":{"id":"2165aa4ed206d385","repo":"hashicorp/vagrant","slug":"an-error-occurred-while-uploading-the-file-the-er","errorCode":null,"errorMessage":"An error occurred while uploading the file. The error\nmessage, if any, is reproduced below. Please fix this error and try\nagain.\n\nexit code: %{exit_code}\n%{message}","messagePattern":"An error occurred while uploading the file\\. The error\nmessage, if any, is reproduced below\\. Please fix this error and try\nagain\\.\n\nexit code: %(.+?)\n%(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::UploaderError","httpStatus":null,"severity":"error","filePath":"lib/vagrant/util/uploader.rb","lineNumber":94,"sourceCode":"        result = Busy.busy(int_callback) do\n          Subprocess.execute(\"curl\", *options, &data_proc)\n        end\n\n        # If the upload was interrupted, then raise a specific error\n        raise Errors::UploaderInterrupted if interrupted\n\n        # If it didn't exit successfully, we need to parse the data and\n        # show an error message.\n        if result.exit_code != 0\n          @logger.warn(\"Uploader exit code: #{result.exit_code}\")\n          check = result.stderr.match(/\\n*curl:\\s+\\((?<code>\\d+)\\)\\s*(?<error>.*)$/)\n          if !check\n            err_msg = result.stderr\n          else\n            err_msg = check[:error]\n          end\n\n          raise Errors::UploaderError,\n            exit_code: result.exit_code,\n            message: err_msg\n        end\n\n        if @ui\n          @ui.clear_line\n          # Windows doesn't clear properly for some reason, so we just\n          # output one more newline.\n          @ui.detail(\"\") if Platform.windows?\n        end\n        result\n      end\n    end\n  end\nend\n","sourceCodeStart":76,"sourceCodeEnd":110,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/lib/vagrant/util/uploader.rb#L76-L110","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"# before\nvagrant cloud publish myuser/mybox 1.0.0 virtualbox package.box\n# -> error, curl message shows: curl: (22) The requested URL returned error: 401\n\n# after\nvagrant cloud auth login   # or: export VAGRANT_CLOUD_TOKEN=...\nvagrant cloud publish myuser/mybox 1.0.0 virtualbox package.box","handlingStrategy":"try-catch","validationCode":"# bash: verify cloud session + endpoint before a long publish\nvagrant cloud auth whoami >/dev/null 2>&1 || vagrant cloud auth login\ncurl -fsSI -o /dev/null https://app.vagrantup.com/ || { echo 'upload endpoint unreachable'; exit 1; }","typeGuard":null,"tryCatchPattern":"begin\n  Vagrant::Util::Uploader.new(ui, url, uploader_options).upload!\nrescue Vagrant::Errors::UploaderError => e\n  code = e.extra_data[:exit_code].to_i\n  retry if [28, 56].include?(code) # transient curl timeout / recv reset: retry once\n  raise                          # auth (22/401), TLS (60), connect (7): surface to caller\nend","preventionTips":["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"],"tags":["network","upload","curl","vagrant-cloud"],"backgroundTag":"file-upload-failed","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}