{"record":{"id":"52c3080e570ebd7c","repo":"hashicorp/vagrant","slug":"the-specified-output-is-a-directory-please-specif","errorCode":null,"errorMessage":"The specified output is a directory. Please specify a path including a filename.","messagePattern":"The specified output is a directory\\. Please specify a path including a filename\\.","errorType":"exception","errorClass":"Vagrant::Errors::PackageOutputDirectory","httpStatus":null,"severity":"error","filePath":"lib/vagrant/action/general/package.rb","lineNumber":82,"sourceCode":"\n        def initialize(app, env)\n          @app = app\n\n          env[\"package.files\"]  ||= {}\n          env[\"package.info\"]   ||= \"\"\n          env[\"package.output\"] ||= \"package.box\"\n\n          @fullpath = self.class.fullpath(env[\"package.output\"])\n        end\n\n        def call(env)\n          @env = env\n\n          self.class.validate!(env[\"package.output\"], env[\"package.directory\"])\n\n          package_with_folder_path if env[\"package.output\"].include?(File::SEPARATOR)\n\n          raise Errors::PackageOutputDirectory if File.directory?(fullpath)\n\n          raise Errors::PackageInvalidInfo if invalid_info?\n\n          @app.call(env)\n\n          @env[:ui].info I18n.t(\"vagrant.actions.general.package.compressing\", fullpath: fullpath)\n\n          copy_include_files\n          copy_info\n          setup_private_key\n          write_metadata_json\n          compress\n        end\n\n        def package_with_folder_path\n          folder_path = File.expand_path(\"..\", @fullpath)\n          create_box_folder(folder_path) unless File.directory?(folder_path)\n        end","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/lib/vagrant/action/general/package.rb#L64-L100","documentation":"Package validates that the --output path names a file, not a directory: PackageOutputDirectory is raised when the expanded output path is an existing directory (checked both in validate! and again in call after folder handling). The fix is always to include a filename component in the output path.","triggerScenarios":"Running `vagrant package --output ./boxes/` or `--output /tmp` where that path is a directory (lib/vagrant/action/general/package.rb:40-42 and :82). Note: parent directories in an output path are fine — Vagrant creates missing folders via package_with_folder_path; only the final segment must not be an existing directory.","commonSituations":"Passing a target folder instead of a file when scripting packaging; copy-pasting an --output value that was a directory in another workflow; muscle memory from commands like `tar -C dir`.","solutions":["Append a filename: `vagrant package --output boxes/myapp.box`.","If you wanted a clean name each time, combine folder + timestamped filename: `--output \"boxes/myapp-$(date +%s).box\"`."],"exampleFix":"# before\nvagrant package --output ./boxes/      # boxes/ is a directory => error\n\n# after\nvagrant package --output ./boxes/myapp.box   # parent folders are auto-created","handlingStrategy":"validation","validationCode":"# Shell: reject directory outputs before invoking vagrant package\nout=\"${PACKAGE_OUT:-package.box}\"\n[ -d \"$out\" ] && { echo \"--output must include a filename, got directory: $out\"; exit 1; }\nvagrant package --output \"$out\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass a full file path (dir + filename) to --output; Vagrant creates missing parent directories for you.","In shared scripts, build the value as \"${DIR}/${NAME}.box\" so a filename is always appended."],"tags":["vagrant","package","packaging","output-path"],"backgroundTag":"invalid-output-path","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}