{"record":{"id":"ba6719ebf448e08a","repo":"hashicorp/vagrant","slug":"the-file-you-are-attempting-to-upload-does-not-exi","errorCode":null,"errorMessage":"The file you are attempting to upload does not exist. Please recheck that the file exists and was passed in correctly. File: %{file}","messagePattern":"The file you are attempting to upload does not exist\\. Please recheck that the file exists and was passed in correctly\\. File: %(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::BoxFileNotExist","httpStatus":null,"severity":"error","filePath":"plugins/commands/cloud/publish.rb","lineNumber":81,"sourceCode":"          end\n\n          # Parse the options\n          argv = parse_options(opts)\n          return if !argv\n\n          if argv.length < 3 || # missing required arguments\n              argv.length > 4 || # too many arguments\n              (argv.length < 4 && !options.key?(:url)) || # file argument required if url is not provided\n              (argv.length > 3 && options.key?(:url)) # cannot provide url and file argument\n            raise Vagrant::Errors::CLIInvalidUsage,\n              help: opts.help.chomp\n          end\n\n          org, box_name = argv.first.split('/', 2)\n          _, version, provider_name, box_file = argv\n\n          if box_file && !File.file?(box_file)\n            raise Vagrant::Errors::BoxFileNotExist,\n              file: box_file\n          end\n\n          @client = client_login(@env)\n          params = options.slice(:private, :release, :url, :short_description,\n            :description, :version_description, :checksum, :checksum_type,\n            :architecture, :default_architecture)\n\n          # Display output to user describing action to be taken\n          display_preamble(org, box_name, version, provider_name, params)\n\n          if !options[:force]\n            cont = @env.ui.ask(I18n.t(\"cloud_command.continue\"))\n            return 1 if cont.strip.downcase != \"y\"\n          end\n\n          # Load up all the models we'll need to publish the asset\n          box = load_box(org, box_name, @client.token)","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/commands/cloud/publish.rb#L63-L99","documentation":"Vagrant::Errors::BoxFileNotExist is raised by `vagrant cloud publish` when the local box-file argument exists as a string but `File.file?` is false — the path is missing, points to a directory, or dangles as a broken symlink. The check runs before login and any API call, so nothing remote has happened when you see it.","triggerScenarios":"Passing a typo'd or relative path that does not resolve from the current working directory; passing a directory or a symlink to a deleted target as the fourth positional; a shell variable with trailing whitespace or a newline corrupting the path.","commonSituations":"Running publish from a different directory than where the .box file lives; CI checkout paths differing from local ones; files staged on another machine or in an unmounted share; names with spaces quoted inconsistently.","solutions":["Verify from the same shell you invoke vagrant in: `ls -l ./box.box`","Use an absolute path: `vagrant cloud publish myorg/mybox 1.0.0 virtualbox \"$PWD/box.box\"`","If the box file is hosted remotely, drop the file argument and pass --url instead"],"exampleFix":"# before (wrong cwd, relative path)\nvagrant cloud publish myorg/mybox 1.0.0 virtualbox box.box\n# after\nvagrant cloud publish myorg/mybox 1.0.0 virtualbox \"$PWD/box.box\"","handlingStrategy":"validation","validationCode":"# Fail with your own message before invoking vagrant\nbox_file = File.expand_path(ARGV[0] || \"\")\nunless File.file?(box_file)\n  abort \"box file missing or not a regular file: #{box_file}\"\nend\nexec \"vagrant\", \"cloud\", \"publish\", org_box, version, provider, box_file","typeGuard":"# Guard the path value itself before it reaches the CLI\ndef valid_box_file?(path)\n  path.is_a?(String) && !path.strip.empty? && File.file?(File.expand_path(path))\nend","tryCatchPattern":"begin\n  env.cli(%w[cloud publish], org_box, version, provider, box_file)\nrescue Vagrant::Errors::BoxFileNotExist => e\n  $stderr.puts \"staged file vanished: #{e.message}\"\n  exit 66 # EX_NOINPUT\nend","preventionTips":["Resolve box files to absolute paths (File.expand_path / $PWD) before publishing","Check staging in CI: assert the artifact exists right before the publish step","Strip whitespace/newlines from path variables read from files or CI inputs"],"tags":["vagrant","vagrant-cloud","file-not-found","cli","publish"],"backgroundTag":"file-not-found","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}