jordansissel/fpm · error · FPM::InvalidPackageConfiguration

Unknown compression type '#{self.attributes[:deb_compression

Error message

Unknown compression type '#{self.attributes[:deb_compression]}'

What it means

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.

Source

Thrown at lib/fpm/package/deb.rb:729

        compression_flags = ["-j"]
        compressor_options = {"BZIP" => "-#{self.attributes[:deb_compression_level] || 9}"}
      when "xz"
        datatar = build_path("data.tar.xz")
        controltar = build_path("control.tar.xz")
        compression_flags = ["-J"]
        compressor_options = {"XZ_OPT" => "-#{self.attributes[:deb_compression_level] || 3}"}
      when "zst"
        datatar = build_path("data.tar.zst")
        controltar = build_path("control.tar.zst")
        compression_flags = ["--use-compress-program", "zstd"]
        compressor_options = {"ZSTD_CLEVEL" => "-#{self.attributes[:deb_compression_level] || 3}"}
      when "none"
        datatar = build_path("data.tar")
        controltar = build_path("control.tar")
        compression_flags = []
        compressor_options = {}
      else
        raise FPM::InvalidPackageConfiguration,
          "Unknown compression type '#{self.attributes[:deb_compression]}'"
    end
    args = [ tar_cmd, "-C", staging_path ] + compression_flags + data_tar_flags + [ "-cf", datatar, "." ]
    if tar_cmd_supports_sort_names_and_set_mtime? and not attributes[:source_date_epoch].nil?
      # Use gnu tar options to force deterministic file order and timestamp
      args += ["--sort=name", ("--mtime=@%s" % attributes[:source_date_epoch])]
    end
    args.unshift(compressor_options)
    safesystem(*args)

    # pack up the .deb, which is just an 'ar' archive with 3 files
    # the 'debian-binary' file has to be first
    File.expand_path(output_path).tap do |output_path|
      ::Dir.chdir(build_path) do
        safesystem(*ar_cmd, output_path, "debian-binary", controltar, datatar)
      end
    end

View on GitHub (pinned to b6d77ba72a)

Solutions

  1. Set the attribute to a valid value before output: gz, bzip2, xz, zst, or none
  2. Prefer the option machinery (fpm CLI or setting the option string) so validation happens with a clearer message
  3. Audit custom code that copies attributes between package objects for stray values

Example fix

# before (library use)
pkg.attributes[:deb_compression] = 'zstd'
pkg.output('foo.deb')   # -> Unknown compression type 'zstd'

# after
pkg.attributes[:deb_compression] = 'zst'
pkg.output('foo.deb')
Defensive patterns

Strategy: validation

Validate before calling

unless FPM::Package::Deb::COMPRESSION_TYPES.include?(pkg.attributes[:deb_compression].to_s)
  pkg.attributes[:deb_compression] = 'gz'
end

Type guard

def valid_deb_compression?(value)
  FPM::Package::Deb::COMPRESSION_TYPES.include?(value)
end

Try / catch

begin
  pkg.output(out)
rescue FPM::InvalidPackageConfiguration => e
  raise unless e.message =~ /Unknown compression type/   # data.tar stage
  pkg.attributes[:deb_compression] = 'gz'
  retry
end

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of jordansissel/fpm@b6d77ba72a (2026-08-21). Data as JSON: /api/errors/d4e10ef029aecbe6. Report an issue: GitHub.