hashicorp/vagrant · warning

is deprecated. Please use the --provider flag. This

Error message

is deprecated. Please use the --provider flag. This

What it means

Second line of the hardcoded three-line deprecation warning in `vagrant box remove` (remove.rb:61). It is emitted as its own ui.warn call when argv has exactly two entries, telling you the provider-as-second-argument syntax is deprecated and the --provider flag should be used instead. Purely cosmetic split of one sentence across three warn calls; the command still proceeds using argv[1] as the provider.

Source

Thrown at plugins/commands/box/command/remove.rb:61

            end

            o.on("--all-architectures", "Remove all architectures within a provider a version of the box") do |a|
              options[:all_architectures] = a
            end
          end

          # Parse the options
          argv = parse_options(opts)
          return if !argv
          if argv.empty? || argv.length > 2
            raise Vagrant::Errors::CLIInvalidUsage,
              help: opts.help.chomp
          end

          if argv.length == 2
            # @deprecated
            @env.ui.warn("WARNING: The second argument to `vagrant box remove`")
            @env.ui.warn("is deprecated. Please use the --provider flag. This")
            @env.ui.warn("feature will stop working in the next version.")
            options[:provider] = argv[1]
          end

          @env.action_runner.run(Vagrant::Action.action_box_remove, {
            box_name:     argv[0],
            box_architecture: options[:architecture],
            box_provider: options[:provider],
            box_version:  options[:version],
            force_confirm_box_remove: options[:force],
            box_remove_all_versions: options[:all],
            box_remove_all_providers: options[:all_providers],
            box_remove_all_architectures: options[:all_architectures]
          })

          # Success, exit status 0
          0
        end

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Use the flag form: `vagrant box remove <name> --provider <provider>` to make all three lines disappear.
  2. Grep CI/CD definitions and shell scripts for `vagrant box remove .* .*` patterns and fix them.
  3. If you maintain tooling that shells out to vagrant, add a unit assertion that invocations never pass two positional args to box remove.

Example fix

# before
system("vagrant box remove #{name} #{provider}")

# after
system("vagrant box remove #{name} --provider #{provider}")
Defensive patterns

Strategy: validation

Validate before calling

# same guard as the first warning line: enforce flag-style invocation
[ $# -le 1 ] || { echo "second positional arg deprecated; use --provider" >&2; exit 2; }

Prevention

When it happens

Trigger: Exactly the same condition as line 1: `vagrant box remove NAME PROVIDER` with two positional args. The three lines print together whenever argv.length == 2 after option parsing.

Common situations: Same as the first line: legacy scripts, aliases, docs. Because each fragment is a separate warn call, log aggregators sometimes capture only one line, making the warning look truncated or mysterious in CI logs.

Related errors


AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21). Data as JSON: /api/errors/933eaf0937ab65c1. Report an issue: GitHub.