jordansissel/fpm · error · FPM::Package::InvalidArgument
deb compression value of '#{value}' is invalid. Must be one
Error message
deb compression value of '#{value}' is invalid. Must be one of #{COMPRESSION_TYPES.join(", ")} What it means
The --deb-compression option accepts only the values in FPM::Package::Deb::COMPRESSION_TYPES: gz, bzip2, xz, zst, none. The option block validates the value at parse time and raises FPM::Package::InvalidArgument with this message for anything else, before any packaging work starts.
Source
Thrown at lib/fpm/package/deb.rb:76
"version. Default is to be specific. This option allows the same " \
"version of a package but any iteration is permitted"
option "--build-depends", "DEPENDENCY",
"Add DEPENDENCY as a Build-Depends" do |dep|
@build_depends ||= []
@build_depends << dep
end
option "--pre-depends", "DEPENDENCY",
"Add DEPENDENCY as a Pre-Depends" do |dep|
@pre_depends ||= []
@pre_depends << dep
end
option "--compression", "COMPRESSION", "The compression type to use, must " \
"be one of #{COMPRESSION_TYPES.join(", ")}.", :default => "gz" do |value|
if !COMPRESSION_TYPES.include?(value)
raise FPM::Package::InvalidArgument, "deb compression value of '#{value}' is invalid. " \
"Must be one of #{COMPRESSION_TYPES.join(", ")}"
end
value
end
option "--compression-level", "[0-9]", "Select a compression level. 0 is none or minimal. 9 is max compression.",
# Specify which compression level to use on the compressor backend, when building a package
:default => nil do |value|
valint = value.to_i
# if self.attributes[:deb_compression].nil?
# raise "Can't specify a compression level with compression disabled"
# end
unless value =~ /^\d$/ && valint >= 0 && valint <= 9
raise "Invalid compression level '#{value}'. Valid values are integers between 0 and 9 inclusive."
end
valint
end
View on GitHub (pinned to b6d77ba72a)
Solutions
- Use one of the allowed values: gz, bzip2, xz, zst, none
- Check for typos and surrounding whitespace/shell quoting in the value
- If you need a different compressor, build with 'none' and compress the data.tar member yourself afterwards
Example fix
# before fpm -s dir -t deb -n foo --deb-compression zstd . # after fpm -s dir -t deb -n foo --deb-compression zst .
Defensive patterns
Strategy: validation
Validate before calling
ALLOWED = FPM::Package::Deb::COMPRESSION_TYPES # ['gz','bzip2','xz','zst','none']
abort "bad --deb-compression '#{value}'; use one of #{ALLOWED.join(', ')}" unless ALLOWED.include?(value) Type guard
def valid_deb_compression?(value) FPM::Package::Deb::COMPRESSION_TYPES.include?(value) end
Try / catch
begin
pkg.output(out)
rescue FPM::Package::InvalidArgument => e
abort "compression rejected: #{e.message}" # fix the flag/attribute value and rerun
end Prevention
- Whitelist compression values in CI templates against COMPRESSION_TYPES instead of passing raw variables
- Remember the deb spellings: bzip2 (not bz2), zst (not zstd)
- Fail fast in wrappers before invoking fpm when templating compression from external config
When it happens
Trigger: Passing an unsupported compression name on the CLI or via the deb_compression attribute: --deb-compression zstd (dpkg's name), gzip, bz2, lzma, lz4, or misspellings like 'none ' with whitespace. Note the exact spellings: 'bzip2' not 'bz2', 'zst' not 'zstd'.
Common situations: Copy-pasting dpkg-deb or tar flag names into fpm; scripts written for other fpm target types (pacman uses 'zstd'); CI configs parameterizing compression from a variable that drifts from the allowed set.
Related errors
- Unknown compression type '#{compression}' for control.tar in
- Unknown compression type '#{compression}' for data.tar in de
- Unknown compression type '#{self.attributes[:deb_compression
- The version looks invalid for Debian packages. Debian versio
- Missing control.tar in deb source package #{package}
AI-assisted analysis of jordansissel/fpm@b6d77ba72a (2026-08-21).
Data as JSON: /api/errors/fbf078114270770c.
Report an issue: GitHub.