{"record":{"id":"e9f9c3c23cd990df","repo":"hashicorp/vagrant","slug":"package-include-file-doesn-t-exist-file","errorCode":null,"errorMessage":"Package include file doesn't exist: %{file}","messagePattern":"Package include file doesn't exist: %(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::PackageIncludeMissing","httpStatus":null,"severity":"error","filePath":"lib/vagrant/action/general/package_setup_files.rb","lineNumber":42,"sourceCode":"            # expect based on history.\n            if source.relative?\n              dest = source\n            else\n              dest = source.basename\n            end\n\n            # Assign the mapping\n            files[file] = dest\n          end\n\n          if env[\"package.vagrantfile\"]\n            # Vagrantfiles are treated special and mapped to a specific file\n            files[env[\"package.vagrantfile\"]] = \"_Vagrantfile\"\n          end\n\n          # Verify the mapping\n          files.each do |from, _|\n            raise Vagrant::Errors::PackageIncludeMissing,\n                  file: from if !File.exist?(from)\n          end\n\n          # Save the mapping\n          env[\"package.files\"] = files\n\n          @app.call(env)\n        end\n      end\n    end\n  end\nend\n","sourceCodeStart":24,"sourceCodeEnd":55,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/lib/vagrant/action/general/package_setup_files.rb#L24-L55","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Check each path from the message: `ls <path>` from the directory where you run vagrant.","Fix the path — absolute paths are the safest for includes in scripts.","Re-run `vagrant package` from the project root, or regenerate the missing artifact before packaging."],"exampleFix":"# before (run from project root, file lives under artifacts/)\nvagrant package --include manifest.yml    # => PackageIncludeMissing\n\n# after\nvagrant package --include \"$PWD/artifacts/manifest.yml\"","handlingStrategy":"validation","validationCode":"# Shell: verify every include (and vagrantfile override) exists first\nfor f in \"$@\"; do [ -e \"$f\" ] || { echo \"missing include: $f\"; exit 1; }; done\nvagrant package --output \"$OUT\" $(printf -- '--include %s ' \"$@\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use absolute paths (\"$PWD/artifacts/x\") for --include entries in scripts.","Run `vagrant package` from the project root so relative includes resolve predictably.","Make artifact-producing CI steps fail loudly before the package step, so includes are guaranteed to exist."],"tags":["vagrant","package","packaging","include-files"],"backgroundTag":"file-not-found","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}