{"record":{"id":"d4e10ef029aecbe6","repo":"jordansissel/fpm","slug":"unknown-compression-type-self-attributes-deb-c","errorCode":null,"errorMessage":"Unknown compression type '#{self.attributes[:deb_compression]}'","messagePattern":"Unknown compression type '#(.+?)'","errorType":"validation","errorClass":"FPM::InvalidPackageConfiguration","httpStatus":null,"severity":"error","filePath":"lib/fpm/package/deb.rb","lineNumber":729,"sourceCode":"        compression_flags = [\"-j\"]\n        compressor_options = {\"BZIP\" => \"-#{self.attributes[:deb_compression_level] || 9}\"}\n      when \"xz\"\n        datatar = build_path(\"data.tar.xz\")\n        controltar = build_path(\"control.tar.xz\")\n        compression_flags = [\"-J\"]\n        compressor_options = {\"XZ_OPT\" => \"-#{self.attributes[:deb_compression_level] || 3}\"}\n      when \"zst\"\n        datatar = build_path(\"data.tar.zst\")\n        controltar = build_path(\"control.tar.zst\")\n        compression_flags = [\"--use-compress-program\", \"zstd\"]\n        compressor_options = {\"ZSTD_CLEVEL\" => \"-#{self.attributes[:deb_compression_level] || 3}\"}\n      when \"none\"\n        datatar = build_path(\"data.tar\")\n        controltar = build_path(\"control.tar\")\n        compression_flags = []\n        compressor_options = {}\n      else\n        raise FPM::InvalidPackageConfiguration,\n          \"Unknown compression type '#{self.attributes[:deb_compression]}'\"\n    end\n    args = [ tar_cmd, \"-C\", staging_path ] + compression_flags + data_tar_flags + [ \"-cf\", datatar, \".\" ]\n    if tar_cmd_supports_sort_names_and_set_mtime? and not attributes[:source_date_epoch].nil?\n      # Use gnu tar options to force deterministic file order and timestamp\n      args += [\"--sort=name\", (\"--mtime=@%s\" % attributes[:source_date_epoch])]\n    end\n    args.unshift(compressor_options)\n    safesystem(*args)\n\n    # pack up the .deb, which is just an 'ar' archive with 3 files\n    # the 'debian-binary' file has to be first\n    File.expand_path(output_path).tap do |output_path|\n      ::Dir.chdir(build_path) do\n        safesystem(*ar_cmd, output_path, \"debian-binary\", controltar, datatar)\n      end\n    end\n","sourceCodeStart":711,"sourceCodeEnd":747,"githubUrl":"https://github.com/jordansissel/fpm/blob/b6d77ba72a560b687723376a0e5115c3a92634ad/lib/fpm/package/deb.rb#L711-L747","documentation":"During deb output, the main data.tar case statement only handles gz, bzip2, xz, zst and none. Unlike the CLI option path (which validates at parse time and yields the friendlier 'deb compression value' error), this late check fires when attributes[:deb_compression] holds an unrecognized value at build time and raises FPM::InvalidPackageConfiguration.","triggerScenarios":"Using fpm as a Ruby library and assigning pkg.attributes[:deb_compression] = 'zstd'/'lzma'/nil-adjacent garbage directly, bypassing option validation; or a converted package whose source-type attributes leaked an unusual value into the deb output stage.","commonSituations":"Scripting the fpm API instead of the CLI; plugins/caches that persist attributes between builds; values like 'gzip' or 'bz2' copied from other tools' conventions; nil from custom attribute-mashing code.","solutions":["Set the attribute to a valid value before output: gz, bzip2, xz, zst, or none","Prefer the option machinery (fpm CLI or setting the option string) so validation happens with a clearer message","Audit custom code that copies attributes between package objects for stray values"],"exampleFix":"# before (library use)\npkg.attributes[:deb_compression] = 'zstd'\npkg.output('foo.deb')   # -> Unknown compression type 'zstd'\n\n# after\npkg.attributes[:deb_compression] = 'zst'\npkg.output('foo.deb')","handlingStrategy":"validation","validationCode":"unless FPM::Package::Deb::COMPRESSION_TYPES.include?(pkg.attributes[:deb_compression].to_s)\n  pkg.attributes[:deb_compression] = 'gz'\nend","typeGuard":"def valid_deb_compression?(value)\n  FPM::Package::Deb::COMPRESSION_TYPES.include?(value)\nend","tryCatchPattern":"begin\n  pkg.output(out)\nrescue FPM::InvalidPackageConfiguration => e\n  raise unless e.message =~ /Unknown compression type/   # data.tar stage\n  pkg.attributes[:deb_compression] = 'gz'\n  retry\nend","preventionTips":["When scripting the fpm API, always set deb_compression from a whitelisted constant","Use the CLI option layer (or re-set the option string) so early validation catches typos","Diff attribute sets after package conversion to catch foreign values leaking into deb output"],"tags":["fpm","deb","compression","output","api-misuse","packaging"],"backgroundTag":"invalid-option-value","analyzedSha":"b6d77ba72a560b687723376a0e5115c3a92634ad","analyzedAt":"2026-08-21T16:39:02.570Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}