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
- Rename the file to exactly `info.json` and keep it in place.
- Verify the path you pass exists from the directory where vagrant runs (`ls $(pwd)/path/to/info.json`); prefer absolute paths.
- Validate the file's contents parse as JSON (`python3 -m json.tool info.json`) so downstream consumers don't choke.
- 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
- Name the packaging info file exactly `info.json` — the basename is part of the contract.
- Pass absolute paths for the info file so cwd changes don't break packaging scripts.
- JSON-parse the file in your packaging pipeline so content errors surface before vagrant runs.
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
- The specified file '%{filename}' to save the package as alre
- The specified output is a directory. Please specify a path i
- Package include file doesn't exist: %{file}
- The Vagrant virtual environment you are trying to package mu
- The box you're using with the Hyper-V provider ('%{name}') i
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/f6590f24d246a530.
Report an issue: GitHub.