hashicorp/vagrant · error · Vagrant::Errors::PackageInvalidInfo

The information file that you've attempted to include doesn'

Error message

The information file that you've attempted to include doesn't exist or isn't a valid JSON file. Please check that the file exists and is titled 'info.json' and try again.

What it means

When packaging with an info file (env["package.info"], surfaced by tooling/plugins that drive `vagrant package`), invalid_info? requires the path to be an existing file whose basename is exactly 'info.json'. If the path is empty of nothing — but when set and the file is missing or named differently, PackageInvalidInfo is raised. (Despite the message mentioning JSON validity, the code checks existence and filename only.)

Source

Thrown at lib/vagrant/action/general/package.rb:84

          @app = app

          env["package.files"]  ||= {}
          env["package.info"]   ||= ""
          env["package.output"] ||= "package.box"

          @fullpath = self.class.fullpath(env["package.output"])
        end

        def call(env)
          @env = env

          self.class.validate!(env["package.output"], env["package.directory"])

          package_with_folder_path if env["package.output"].include?(File::SEPARATOR)

          raise Errors::PackageOutputDirectory if File.directory?(fullpath)

          raise Errors::PackageInvalidInfo if invalid_info?

          @app.call(env)

          @env[:ui].info I18n.t("vagrant.actions.general.package.compressing", fullpath: fullpath)

          copy_include_files
          copy_info
          setup_private_key
          write_metadata_json
          compress
        end

        def package_with_folder_path
          folder_path = File.expand_path("..", @fullpath)
          create_box_folder(folder_path) unless File.directory?(folder_path)
        end

        def create_box_folder(folder_path)

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Rename the file to exactly `info.json` and keep it in place.
  2. Verify the path you pass exists from the directory where vagrant runs (`ls $(pwd)/path/to/info.json`); prefer absolute paths.
  3. Validate the file's contents parse as JSON (`python3 -m json.tool info.json`) so downstream consumers don't choke.
  4. If you didn't intend to ship an info file, unset/drop the option entirely — when package.info is empty the check is skipped.

Example fix

# before
vagrant package --output my.box --info ./box-metadata.json   # wrong name

# after
mv box-metadata.json info.json
vagrant package --output my.box --info ./info.json
Defensive patterns

Strategy: validation

Validate before calling

# Ruby: validate the info file before packaging
info = ENV["PACKAGE_INFO"]
if info && !info.empty?
  abort "info file missing" unless File.file?(info)
  abort "must be named info.json" unless File.basename(info) == "info.json"
  require "json"; JSON.parse(File.read(info))
end

Prevention

When it happens

Trigger: Setting package.info to a path that does not exist, or to a file not named info.json (e.g. metadata.json, box_info.json) — via the package command's info option in tooling that exposes it, or programmatically through the Package action (lib/vagrant/action/general/package.rb:84, :237-244).

Common situations: Custom packaging scripts renaming the info file for clarity; passing a relative path that doesn't resolve from the cwd vagrant runs in; stale docs referencing an arbitrary filename.

Related errors


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