{"record":{"id":"d14854ecc4deda28","repo":"jordansissel/fpm","slug":"invalid-log-level-v-inspect-must-be-one-of","errorCode":null,"errorMessage":"Invalid log level, #{v.inspect}. Must be one of: #{loglevels.join(\", \")}","messagePattern":"Invalid log level, #(.+?)\\. Must be one of: #(.+?)","errorType":"validation","errorClass":"FPM::Package::InvalidArgument","httpStatus":null,"severity":"error","filePath":"lib/fpm/command.rb","lineNumber":70,"sourceCode":"    :attribute_name => :input_type\n  option [\"-C\", \"--chdir\"], \"CHDIR\",\n    \"Change directory to here before searching for files\",\n    :attribute_name => :chdir\n  option \"--prefix\", \"PREFIX\",\n    \"A path to prefix files with when building the target package. This may \" \\\n    \"not be necessary for all input packages. For example, the 'gem' type \" \\\n    \"will prefix with your gem directory automatically.\"\n  option [\"-p\", \"--package\"], \"OUTPUT\", \"The package file path to output.\"\n  option [\"-f\", \"--force\"], :flag, \"Force output even if it will overwrite an \" \\\n    \"existing file\", :default => false\n  option [\"-n\", \"--name\"], \"NAME\", \"The name to give to the package\"\n\n  loglevels = %w(error warn info debug)\n  option \"--log\", \"LEVEL\", \"Set the log level. Values: #{loglevels.join(\", \")}.\",\n    :attribute_name => :log_level do |val|\n    val.downcase.tap do |v|\n      if !loglevels.include?(v)\n        raise FPM::Package::InvalidArgument, \"Invalid log level, #{v.inspect}. Must be one of: #{loglevels.join(\", \")}\"\n      end\n    end\n  end # --log\n  option \"--verbose\", :flag, \"Enable verbose output\"\n  option \"--debug\", :flag, \"Enable debug output\"\n  option \"--debug-workspace\", :flag, \"Keep any file workspaces around for \" \\\n    \"debugging. This will disable automatic cleanup of package staging and \" \\\n    \"build paths. It will also print which directories are available.\"\n  option [\"-v\", \"--version\"], \"VERSION\", \"The version to give to the package\",\n    :default => 1.0\n  option \"--iteration\", \"ITERATION\",\n    \"The iteration to give to the package. RPM calls this the 'release'. \" \\\n    \"FreeBSD calls it 'PORTREVISION'. Debian calls this 'debian_revision'\"\n  option \"--epoch\", \"EPOCH\",\n    \"The epoch value for this package. RPM and Debian calls this 'epoch'. \" \\\n    \"FreeBSD calls this 'PORTEPOCH'\"\n  option \"--license\", \"LICENSE\",\n    \"(optional) license name for this package\"","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/jordansissel/fpm/blob/b6d77ba72a560b687723376a0e5115c3a92634ad/lib/fpm/command.rb#L52-L88","documentation":"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.","triggerScenarios":"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.","commonSituations":"Confusing --log levels with --verbose/--debug flags; carrying a 'verbose' habit over from other CLIs; options files shared across teams drifting to invalid values.","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"],"exampleFix":"# before\nfpm --log verbose -s dir -t deb ./app\n\n# after\nfpm --log debug -s dir -t deb ./app","handlingStrategy":"validation","validationCode":"levels = %w[error warn info debug]\nlevel = ENV.fetch('FPM_LOG_LEVEL', 'info')\nraise ArgumentError, \"invalid log level #{level}; use #{levels.join('|')}\" unless levels.include?(level.downcase)\nsystem('fpm', '--log', level, '-s', 'dir', '-t', 'deb', './app')","typeGuard":null,"tryCatchPattern":"begin\n  FPM::Command.run(%w[--log verbose -s dir -t deb .])\nrescue FPM::Package::InvalidArgument => e\n  warn \"bad fpm flag value: #{e.message}\"\nend","preventionTips":["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"],"tags":["fpm","cli","logging","argument-validation"],"backgroundTag":"invalid-option-value","analyzedSha":"b6d77ba72a560b687723376a0e5115c3a92634ad","analyzedAt":"2026-08-21T16:39:02.570Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}