{"record":{"id":"19cfb7d2152b4f9f","repo":"hashicorp/vagrant","slug":"this-command-was-not-invoked-properly-the-help-fo-19cfb7","errorCode":null,"errorMessage":"This command was not invoked properly. The help for this command is available below. %{help}","messagePattern":"This command was not invoked properly\\. The help for this command is available below\\. %(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::CLIInvalidUsage","httpStatus":null,"severity":"error","filePath":"plugins/commands/cloud/publish.rb","lineNumber":73,"sourceCode":"              options[:checksum_type] = c\n            end\n            o.on(\"--[no-]direct-upload\", \"Upload asset directly to backend storage\") do |d|\n              options[:direct_upload] = d\n            end\n            o.on(\"--[no-]default-architecture\", \"Mark as default architecture for specific provider\") do |d|\n              options[:default_architecture] = d\n            end\n          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)","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/commands/cloud/publish.rb#L55-L91","documentation":"`vagrant cloud publish` validates its argument vector combinatorially: it needs 3 or 4 positional arguments (`org/box-name version provider [box-file]`); the 3-argument form requires --url to be set (the box file is hosted remotely), and the 4-argument form forbids --url (you cannot supply both a URL and a local file). Violating any branch raises CLIInvalidUsage.","triggerScenarios":"`vagrant cloud publish org/box 1.0.0 virtualbox` with no --url (3 args, missing remote location); `vagrant cloud publish org/box 1.0.0 virtualbox ./box.box --url https://...` (4 args plus --url, both sources given); five or more positionals.","commonSituations":"Migrating from the older five-argument publish syntax (org box version provider file as separate positionals); assuming --url is additive; forgetting --url in direct-URL workflows or forgetting to drop it when switching to local files.","solutions":["Remote form (3 args + URL): `vagrant cloud publish org/box 1.0.0 virtualbox --url https://example.com/box.box`","Local form (4 args, no URL): `vagrant cloud publish org/box 1.0.0 virtualbox ./box.box`","Check `vagrant cloud publish -h` — the banner shows both accepted forms"],"exampleFix":"# before (both a file and --url given)\nvagrant cloud publish myorg/mybox 1.0.0 virtualbox ./box.box --url https://example.com/box.box\n# after\nvagrant cloud publish myorg/mybox 1.0.0 virtualbox ./box.box","handlingStrategy":"validation","validationCode":"# Mirror publish's exclusive-or rule before invoking\nn = positional_args_count   # args after flag extraction\nhas_url = !options[:url].nil?\nvalid = (n == 3 && has_url) || (n == 4 && !has_url)\nabort \"usage: vagrant cloud publish org/box version provider [file | --url URL]\" unless valid","typeGuard":null,"tryCatchPattern":"begin\n  argv = %w[cloud publish] + (url ? [\"--url\", url] : []) + [org_box, version, provider, *file]\n  env.cli(*argv)\nrescue Vagrant::Errors::CLIInvalidUsage => e\n  $stderr.puts e.message.lines.first\n  exit 64\nend","preventionTips":["Decide once per script whether boxes are uploaded or URL-referenced; never mix","Encode the file-xor-URL rule in your release tooling so users cannot violate it","Pin to the current 3/4-argument syntax when migrating from pre-2.x publish commands"],"tags":["vagrant","vagrant-cloud","cli","argument-validation","publish"],"backgroundTag":"cli-invalid-usage","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}