jordansissel/fpm · error · FPM::Package::InvalidArgument

Options file given to --fpm-options-file is seems too…

Error message

Options file given to --fpm-options-file is seems too large. For safety, fpm is refusing to load this. Path: #{path} - Size: #{stat.size}, maximum allowed size #{max}.

What it means

As a safety valve, load_options refuses options files larger than 100 KiB (100 * 1024 bytes, checked via File.stat). Larger files raise FPM::Package::InvalidArgument with the observed size and the limit — usually a sign the wrong file was referenced or the flags file is machine-generated and bloated.

Solutions

  1. Split the options file into several smaller files (each under 100 KiB) and reference them individually
  2. Deduplicate and trim flag lines (repeated --exclude patterns often collapse with wildcards)
  3. Verify the path actually points at an fpm flags file, not an arbitrary large file

Example fix

# before: single generated excludes.txt at 300kb
fpm --fpm-options-file excludes.conf ...

# after: split by concern
csplit -k excludes.conf 50000   # then keep each part under 100kb
fpm --fpm-options-file excludes-a.conf --fpm-options-file excludes-b.conf ...
Defensive patterns

Strategy: validation

Validate before calling

path = 'fpm.conf'
abort 'options file exceeds fpm 100kb safety limit' if File.size(path) > 100 * 1024
system('fpm', '--fpm-options-file', path, '-s', 'dir', '-t', 'deb', './app')

Try / catch

begin
  FPM::Command.run(argv)
rescue FPM::Package::InvalidArgument => e
  abort "options file rejected: #{e.message}"
end

Prevention

When it happens

Trigger: A generated options file with thousands of --exclude/--depends lines exceeding 100 KiB; accidentally pointing --fpm-options-file at a large unrelated file or binary.

Common situations: Auto-generated exclusion lists from find/grep; monorepos accumulating per-package flags in one shared file; a wrong path hitting a big artifact.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


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

Appendix: source

Thrown at lib/fpm/command.rb:630

    if !File.exist?(path)
      logger.fatal("Cannot load options from file because the file doesn't exist.", :path => path)
    end

    if !File.readable?(path)
      logger.fatal("Cannot load options from file because the file isn't readable.", :path => path)
    end

    @loaded_files << path

    logger.info("Loading flags from file", :path => path)

    # Safety check, abort if the file is huge. Arbitrarily chosen limit is 100kb
    stat = File.stat(path)
    max = 100 * 1024
    if stat.size > max
      logger.fatal("Refusing to load options from file because the file seems pretty large.", :path => path, :size => stat.size)
      raise FPM::Package::InvalidArgument, "Options file given to --fpm-options-file is seems too large. For safety, fpm is refusing to load this. Path: #{path} - Size: #{stat.size}, maximum allowed size #{max}."
    end

    File.read(path).split($/).each do |line|
      logger.info("Processing flags from file", :path => path, :line => line)
      # With apologies for this hack to mdub (Mike Williams, author of Clamp)...
      # The following code will read a file and parse the file
      # as flags as if they were in same argument position as the given --fpm-options-file option.

      args = Shellwords.split(line)
      while args.any?
        arg = args.shift

        # Lookup the Clamp option by its --flag-name or short  name like -f
        if arg =~ /^-/
          # Single-letter options like -a or -z
          if single_letter = arg.match(/^(-[A-Za-z0-9])(.*)$/)
            option = self.class.find_option(single_letter.match(1))
            arg, remainder = single_letter.match(1), single_letter.match(2)

View on GitHub (pinned to b6d77ba72a)