hashicorp/vagrant · warning

Vagrant is automatically disabling direct upload to backend

Error message

Vagrant is automatically disabling direct upload to backend storage.
Uploads directly to backend storage are currently only supported for
files 5G in size or smaller. Box file to upload is: %{size}

What it means

Same direct-upload size guard, in the publish flow (publish.rb, upload_box_file). When options[:direct_upload] is true (publish defaults direct_upload: true in its option setup) and File.stat(box_file).size exceeds 5 GiB, it prints the size and sets options[:direct_upload] = false before calling provider.upload(direct: false), which uploads through the standard relayed URL instead of backend-direct storage.

Source

Thrown at plugins/commands/cloud/publish.rb:152

          1
        end

        # Upload the file for the given box provider
        #
        # @param [VagrantCloud::Box::Provider] provider Vagrant Cloud box version provider
        # @param [String] box_file Path to local asset for upload
        # @param [Hash] options
        # @option options [Boolean] :direct_upload Upload directly to backend storage
        # @return [nil]
        def upload_box_file(provider, box_file, options={})
          box_file = File.absolute_path(box_file)
          @env.ui.info(I18n.t("cloud_command.publish.upload_provider", file: box_file))
          # Include size check on file and disable direct if over 5G
          if options[:direct_upload]
            fsize = File.stat(box_file).size
            if fsize > (5 * Vagrant::Util::Numeric::GIGABYTE)
              box_size = Vagrant::Util::Numeric.bytes_to_string(fsize)
              @env.ui.warn(I18n.t("cloud_command.provider.direct_disable", size: box_size))
              options[:direct_upload] = false
            end
          end

          provider.upload(direct: options[:direct_upload]) do |upload_url|
            Vagrant::Util::Uploader.new(upload_url, box_file, ui: @env.ui, method: :put).upload!
          end
          nil
        end

        # Release the box version
        #
        # @param [VagrantCloud::Box::Version] version Vagrant Cloud box version
        # @return [nil]
        def release_version(version)
          @env.ui.info(I18n.t("cloud_command.publish.release"))
          version.release
          nil

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. No action needed to succeed — the fallback upload still delivers the file; just expect longer transfer time.
  2. Reduce artifact size below 5G (repackage/compress the box) to keep the faster direct path.
  3. For predictable behavior pass the direct-upload flag explicitly based on measured size in your publish script.
  4. Monitor the publish output for this warning to know which path was actually taken when tuning upload timeouts.

Example fix

# before
vagrant cloud publish myorg/app 1.0.0 virtualbox ./app-big.box --release
# >5G file -> direct upload auto-disabled (slower relayed path)

# after (pre-compress to stay under the limit and keep direct upload)
gzip -k ./app-big.box   # or vagrant package with a trimmed disk
vagrant cloud publish myorg/app 1.0.0 virtualbox ./app-big.box.gz --release
Defensive patterns

Strategy: validation

Validate before calling

MAX=5368709120  # 5 GiB, publish enables direct_upload by default
size=$(stat -c %s "$BOX_FILE" 2>/dev/null || stat -f %z "$BOX_FILE")
FLAG=--direct-upload
[ "$size" -le "$MAX" ] || FLAG=""
vagrant cloud publish "$ORG/$BOX" "$VER" "$PROVIDER" "$BOX_FILE" $FLAG

Prevention

When it happens

Trigger: Running `vagrant cloud publish org/box 1.0.0 virtualbox ./big.box` (or with explicit --direct-upload) where big.box is over 5 GiB; note publish enables direct upload by default, so this fires without any flag on large artifacts.

Common situations: Publishing full-disk virtualbox images that exceed 5G and noticing slower uploads than expected; CI publish jobs assuming direct transfer always happens; teams surprised the default-on direct path quietly degrades.

Related errors


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