{"record":{"id":"a37c589fe9381ec3","repo":"hashicorp/vagrant","slug":"the-compression-type-requested-for-upload-type","errorCode":null,"errorMessage":"The compression type requested for upload (`%{type}`) is not a\nsupported value. Try uploading again using a valid compression\ntype.\n\n  Supported types: %{valid_types}","messagePattern":"The compression type requested for upload \\(`%(.+?)`\\) is not a\nsupported value\\. Try uploading again using a valid compression\ntype\\.\n\n  Supported types: %(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::UploadInvalidCompressionType","httpStatus":null,"severity":"error","filePath":"plugins/commands/upload/command.rb","lineNumber":144,"sourceCode":"        # Success, exit status 0\n        0\n      end\n\n      # Setup compression options and validate host and guest have capability\n      # to handle compression\n      #\n      # @param [Vagrant::Machine] machine Vagrant guest machine\n      # @param [Hash] options Command options\n      def compression_setup!(machine, options)\n        if !options[:compression_type]\n          if machine.guest.capability_host_chain.first[0] == :windows\n            options[:compression_type] = :zip\n          else\n            options[:compression_type] = :tgz\n          end\n        end\n        if !VALID_COMPRESS_TYPES.include?(options[:compression_type])\n          raise Vagrant::Errors::UploadInvalidCompressionType,\n            type: options[:compression_type],\n            valid_types: VALID_COMPRESS_TYPES.join(\", \")\n        end\n        options[:decompression_method] = \"decompress_#{options[:compression_type]}\".to_sym\n        if !machine.guest.capability?(options[:decompression_method])\n          raise Vagrant::Errors::UploadMissingExtractCapability,\n            type: options[:compression_type]\n        end\n      end\n\n      # Compress path using zip into temporary file\n      #\n      # @param [String] path Path to compress\n      # @return [String] path to compressed file\n      def compress_source_zip(path)\n        require \"zip\"\n        zipfile = Tempfile.create([\"vagrant\", \".zip\"])\n        zipfile.close","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/commands/upload/command.rb#L126-L162","documentation":"`vagrant upload --compression-type=TYPE` (or -C) only accepts values in VALID_COMPRESS_TYPES, hard-coded to `[:tgz, :zip]` in the upload command. compression_setup! raises UploadInvalidCompressionType when the requested value is not in that list. When no type is given one is auto-selected (zip when the guest chain is Windows, tgz otherwise), so the error only fires on an explicit invalid value.","triggerScenarios":"Passing `-C gzip`, `--compression-type=tar.gz`, or any string other than exactly `tgz` or `zip`; programmatically setting options[:compression_type] to an unsupported symbol; case differences such as `TGZ` because the comparison is exact.","commonSituations":"Users assuming gzip/tar/bz2 are supported because the `-c/--compress` help mentions gzip; scripts ported from another upload tool's flags; uppercase type names.","solutions":["Use exactly `tgz` or `zip`: `vagrant upload -C tgz <src> <dst>`","Drop `-C/--compression-type` entirely and let the command auto-select (zip for Windows guests, tgz otherwise)","Check `vagrant upload -h`; the valid values are listed in the option help"],"exampleFix":"# before\nvagrant upload -C gzip app_dir /tmp/app_dir\n\n# after\nvagrant upload -C tgz app_dir /tmp/app_dir   # or omit -C","handlingStrategy":"validation","validationCode":"VALID = %w[tgz zip]\nabort \"invalid compression type #{t}; use #{VALID.join(' or ')}\" unless VALID.include?(t.to_s.downcase)\nsystem('vagrant', 'upload', '-C', t, src, dst)","typeGuard":"valid_compression_type = ->(t) { %i[tgz zip].include?(t.to_s.downcase.to_sym) }","tryCatchPattern":"begin\n  command.execute\nrescue Vagrant::Errors::UploadInvalidCompressionType => e\n  warn \"#{e.extra_data[:type]} invalid; valid: #{e.extra_data[:valid_types]}\"\n  exit 1\nend","preventionTips":["Restrict -C values to the documented set (tgz, zip)","Omit the flag and let Vagrant choose the type per guest platform","Validate option values in wrappers against `vagrant upload -h`"],"tags":["vagrant","upload","compression","invalid-option-value","cli"],"backgroundTag":"invalid-option-value","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}