jordansissel/fpm · error · FPM::Package::InvalidArgument
Options file given to --fpm-options-file is seems too large.
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.
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)
Solutions
- Split the options file into several smaller files (each under 100 KiB) and reference them individually
- Deduplicate and trim flag lines (repeated --exclude patterns often collapse with wildcards)
- 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
- Assert File.size(path) <= 100 * 1024 in the build script
- Keep generated flag lists deduplicated and wildcarded so they stay small
- Confirm --fpm-options-file references a flags file, never an arbitrary large artifact
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.
Related errors
- Invalid log level, #{v.inspect}. Must be one of: #{loglevels
- The given workdir '#{workdir}' does not exist.
- The given workdir '#{workdir}' must be a directory.
- 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/e797fd3b5f197df8.
Report an issue: GitHub.