{"record":{"id":"511b3ceffcb99abb","repo":"hashicorp/vagrant","slug":"this-command-was-not-invoked-properly-the-help-fo-511b3c","errorCode":null,"errorMessage":"This command was not invoked properly. The help for this command is\navailable below.\n\n%{help}","messagePattern":"This command was not invoked properly\\. The help for this command is\navailable below\\.\n\n%(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::CLIInvalidUsage","httpStatus":null,"severity":"error","filePath":"plugins/commands/upload/command.rb","lineNumber":54,"sourceCode":"            options[:compress] = true\n          end\n        end\n\n        argv = parse_options(opts)\n        return if !argv\n\n        case argv.size\n        when 3\n          source, destination, guest = argv\n        when 2, 1\n          source = argv[0]\n          if @env.active_machines.map(&:first).map(&:to_s).include?(argv[1])\n            guest = argv[1]\n          else\n            destination = argv[1]\n          end\n        else\n          raise Vagrant::Errors::CLIInvalidUsage, help: opts.help.chomp\n        end\n\n        # NOTE: We do this to handle paths on Windows like: \"..\\space dir\\\"\n        # because the final separator acts to escape the quote and ends up\n        # in the source value.\n        source = source.sub(/[\"']$/, \"\")\n        destination ||= File.basename(source)\n\n        if File.file?(source)\n          type = :file\n        elsif File.directory?(source)\n          type = :directory\n        else\n          raise Vagrant::Errors::UploadSourceMissing,\n            source: source\n        end\n\n        with_target_vms(guest, single_target: true) do |machine|","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/commands/upload/command.rb#L36-L72","documentation":"`vagrant upload [options] <source> [destination] [name|id]` raises CLIInvalidUsage when the number of positional arguments is not 1-3: zero arguments, or four or more. The two-argument form auto-detects whether the second token is a guest name/id (matching an active machine) or a destination path, so anything outside that arity is rejected up front.","triggerScenarios":"`vagrant upload` with no source; `vagrant upload a b c d` (four positionals); Windows quoting where a trailing backslash escapes the closing quote and splits one path into extra tokens.","commonSituations":"Windows paths like `\"..\\dir\\\"` producing a stray token; scripts copying the 3-arg form plus an extra flag; forgetting the source while passing only destination and machine name.","solutions":["Use `vagrant upload <source> [destination] [name|id]` with 1-3 positional arguments","On Windows, quote paths and avoid a trailing backslash immediately before the closing quote","Run `vagrant upload -h` to re-check the argument layout"],"exampleFix":"# before\nvagrant upload\nvagrant upload dist/ /vagrant/dist web extra\n\n# after\nvagrant upload dist/ /vagrant/dist web","handlingStrategy":"validation","validationCode":"positional = argv.reject { |a| a.start_with?('-') }\nraise ArgumentError, 'usage: vagrant upload <source> [destination] [name|id]' unless (1..3).cover?(positional.size)\nsystem('vagrant', 'upload', *positional)","typeGuard":null,"tryCatchPattern":"begin\n  VagrantPlugins::CommandUpload::Command.new(argv, env).execute\nrescue Vagrant::Errors::CLIInvalidUsage => e\n  warn e.extra_data[:help]\n  exit 1\nend","preventionTips":["Count positional tokens before invoking upload (1-3 allowed)","Normalize Windows paths before passing them (strip trailing backslash-quote artifacts)","Re-check `vagrant upload -h` when writing cross-platform scripts"],"tags":["vagrant","upload","cli","usage","windows-paths"],"backgroundTag":"cli-invalid-usage","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}