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

Package include file doesn't exist: %{file}

Error message

Package include file doesn't exist: %{file}

What it means

The package_setup_files middleware builds the package.files map from `--include` entries (plus `--vagrantfile`, which is mapped to '_Vagrantfile'), then verifies each source path exists on the host. The first missing source raises PackageIncludeMissing naming that file, before any packaging work begins.

Source

Thrown at lib/vagrant/action/general/package_setup_files.rb:42

            # expect based on history.
            if source.relative?
              dest = source
            else
              dest = source.basename
            end

            # Assign the mapping
            files[file] = dest
          end

          if env["package.vagrantfile"]
            # Vagrantfiles are treated special and mapped to a specific file
            files[env["package.vagrantfile"]] = "_Vagrantfile"
          end

          # Verify the mapping
          files.each do |from, _|
            raise Vagrant::Errors::PackageIncludeMissing,
                  file: from if !File.exist?(from)
          end

          # Save the mapping
          env["package.files"] = files

          @app.call(env)
        end
      end
    end
  end
end

View on GitHub (pinned to 35f3160f4a)

Solutions

  1. Check each path from the message: `ls <path>` from the directory where you run vagrant.
  2. Fix the path — absolute paths are the safest for includes in scripts.
  3. Re-run `vagrant package` from the project root, or regenerate the missing artifact before packaging.

Example fix

# before (run from project root, file lives under artifacts/)
vagrant package --include manifest.yml    # => PackageIncludeMissing

# after
vagrant package --include "$PWD/artifacts/manifest.yml"
Defensive patterns

Strategy: validation

Validate before calling

# Shell: verify every include (and vagrantfile override) exists first
for f in "$@"; do [ -e "$f" ] || { echo "missing include: $f"; exit 1; }; done
vagrant package --output "$OUT" $(printf -- '--include %s ' "$@")

Prevention

When it happens

Trigger: Running `vagrant package --include file.txt` (or --vagrantfile Vagrantfile.pkg) where any listed path does not exist — typo, wrong relative directory, or file generated by a previous skipped step (lib/vagrant/action/general/package_setup_files.rb:38-44).

Common situations: Relative include paths resolved against the current working directory rather than the project root; CI steps where an artifact wasn't produced before packaging; renamed files after refactoring a packaging script.

Related errors


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