jordansissel/fpm · error · FPM::Package::InvalidArgument
Invalid log level, #{v.inspect}. Must be one of: #{loglevels
Error message
Invalid log level, #{v.inspect}. Must be one of: #{loglevels.join(", ")} What it means
The --log option validates its value (case-insensitively, after downcasing) against error, warn, info, debug and raises FPM::Package::InvalidArgument at option-parse time for anything else, aborting the run before any packaging work starts.
Source
Thrown at lib/fpm/command.rb:70
:attribute_name => :input_type
option ["-C", "--chdir"], "CHDIR",
"Change directory to here before searching for files",
:attribute_name => :chdir
option "--prefix", "PREFIX",
"A path to prefix files with when building the target package. This may " \
"not be necessary for all input packages. For example, the 'gem' type " \
"will prefix with your gem directory automatically."
option ["-p", "--package"], "OUTPUT", "The package file path to output."
option ["-f", "--force"], :flag, "Force output even if it will overwrite an " \
"existing file", :default => false
option ["-n", "--name"], "NAME", "The name to give to the package"
loglevels = %w(error warn info debug)
option "--log", "LEVEL", "Set the log level. Values: #{loglevels.join(", ")}.",
:attribute_name => :log_level do |val|
val.downcase.tap do |v|
if !loglevels.include?(v)
raise FPM::Package::InvalidArgument, "Invalid log level, #{v.inspect}. Must be one of: #{loglevels.join(", ")}"
end
end
end # --log
option "--verbose", :flag, "Enable verbose output"
option "--debug", :flag, "Enable debug output"
option "--debug-workspace", :flag, "Keep any file workspaces around for " \
"debugging. This will disable automatic cleanup of package staging and " \
"build paths. It will also print which directories are available."
option ["-v", "--version"], "VERSION", "The version to give to the package",
:default => 1.0
option "--iteration", "ITERATION",
"The iteration to give to the package. RPM calls this the 'release'. " \
"FreeBSD calls it 'PORTREVISION'. Debian calls this 'debian_revision'"
option "--epoch", "EPOCH",
"The epoch value for this package. RPM and Debian calls this 'epoch'. " \
"FreeBSD calls this 'PORTEPOCH'"
option "--license", "LICENSE",
"(optional) license name for this package"View on GitHub (pinned to b6d77ba72a)
Solutions
- Use one of the four accepted levels (any case): --log error|warn|info|debug
- If the flag came from an options file, fix that line in the file
- Remember --verbose and --debug are separate boolean flags, not --log values
Example fix
# before fpm --log verbose -s dir -t deb ./app # after fpm --log debug -s dir -t deb ./app
Defensive patterns
Strategy: validation
Validate before calling
levels = %w[error warn info debug]
level = ENV.fetch('FPM_LOG_LEVEL', 'info')
raise ArgumentError, "invalid log level #{level}; use #{levels.join('|')}" unless levels.include?(level.downcase)
system('fpm', '--log', level, '-s', 'dir', '-t', 'deb', './app') Try / catch
begin
FPM::Command.run(%w[--log verbose -s dir -t deb .])
rescue FPM::Package::InvalidArgument => e
warn "bad fpm flag value: #{e.message}"
end Prevention
- Whitelist --log against error/warn/info/debug in wrapper scripts
- Remember --verbose and --debug are flags, not log levels
- Lint options files for invalid --log values in CI before they reach fpm
When it happens
Trigger: Passing 'fpm --log verbose', '--log trace', or '--log warning' (the accepted level is 'warn'); a bad value inside a --fpm-options-file file; wrapper scripts templating the level from a variable that resolves to an unsupported word.
Common situations: Confusing --log levels with --verbose/--debug flags; carrying a 'verbose' habit over from other CLIs; options files shared across teams drifting to invalid values.
Related errors
- The given workdir '#{workdir}' does not exist.
- The given workdir '#{workdir}' must be a directory.
- Options file given to --fpm-options-file is seems too large.
- Options file already loaded once. Refusing to load a second
- #{self.class.name} does not yet support reading #{self.type}
AI-assisted analysis of jordansissel/fpm@b6d77ba72a (2026-08-21).
Data as JSON: /api/errors/d14854ecc4deda28.
Report an issue: GitHub.