jordansissel/fpm · error · FPM::InvalidPackageConfiguration

Found invalid Provides field values (#{provide.inspect}). Th

Error message

Found invalid Provides field values (#{provide.inspect}). This is not valid in a Debian package.

What it means

On deb output, every Provides entry is normalized (fix_provides) then checked with valid_provides_field?, which matches RELATIONSHIP_FIELD_PATTERN: a name of at least two characters from [A-z0-9_.-] optionally followed by '(= version)'. Debian policy allows only the '=' relation in Provides, so any other operator or malformed entry raises FPM::InvalidPackageConfiguration.

Source

Thrown at lib/fpm/package/deb.rb:503

        datatar = "data.tar"
        compression = ""
      when nil
        raise FPM::InvalidPackageConfiguration, "Missing data.tar in deb source package #{package}"
      else
        raise FPM::InvalidPackageConfiguration,
          "Unknown compression type '#{compression}' for data.tar in deb source package #{package}"
    end

    # unpack the data.tar.{gz,bz2,xz} from the deb package into staging_path
    safesystem(ar_cmd[0] + " p #{package} #{datatar} | tar #{compression} -xf - -C #{staging_path}")
  end # def extract_files

  def output(output_path)
    self.provides = self.provides.collect { |p| fix_provides(p) }

    self.provides.each do |provide|
      if !valid_provides_field?(provide)
        raise FPM::InvalidPackageConfiguration, "Found invalid Provides field values (#{provide.inspect}). This is not valid in a Debian package."
      end
    end
    output_check(output_path)
    # Abort if the target path already exists.

    # create 'debian-binary' file, required to make a valid debian package
    File.write(build_path("debian-binary"), "2.0\n")

    # If we are given --deb-shlibs but no --after-install script, we
    # should implicitly create a before/after scripts that run ldconfig
    if attributes[:deb_shlibs]
      if !script?(:after_install)
        logger.info("You gave --deb-shlibs but no --after-install, so " \
                     "I am adding an after-install script that runs " \
                     "ldconfig to update the system library cache")
        scripts[:after_install] = template("deb/ldconfig.sh.erb").result(binding)
      end
      if !script?(:after_remove)

View on GitHub (pinned to b6d77ba72a)

Solutions

  1. Write provides as bare names or with the exact '=' relation: --provides 'libfoo' or --provides 'libfoo (= 1.2.3)'
  2. Replace >=/<=/'>>' operators with '=' or drop the versioned part entirely
  3. Ensure names are at least two characters and contain only letters, digits, underscore, dot, hyphen
  4. When converting package types, sanitize/override provides with --provides instead of carrying them over

Example fix

# before
fpm -s dir -t deb -n foo --provides 'libfoo (>= 1.2)' .
# -> Found invalid Provides field values

# after
fpm -s dir -t deb -n foo --provides 'libfoo (= 1.2)' .
# or simply: --provides 'libfoo'
Defensive patterns

Strategy: validation

Validate before calling

REL = /\A(?<name>[A-z0-9][A-z0-9_.-]+)(?:\s*\((?<relation>[<>=]+)\s(?<version>.+?)\))?\z/

def valid_provides?(entry)
  m = REL.match(entry)
  !m.nil? && (m[:relation].nil? || m[:relation] == '=')
end

provides.each { |p| abort "invalid deb Provides '#{p}'" unless valid_provides?(p) }

Type guard

def deb_provides_entry?(text)
  m = /\A([A-z0-9][A-z0-9_.-]+)(?:\s*([<>=]+)\s(.+?))?\z/.match(text)
  !m.nil? && (m[2].nil? || m[2] == '=')
end

Try / catch

begin
  pkg.output(out)
rescue FPM::InvalidPackageConfiguration => e
  raise unless e.message =~ /invalid Provides field values/
  pkg.provides = pkg.provides.map { |p| p.sub(/\s*\([^)]*\)/, '') }  # drop bad relations
  retry
end

Prevention

When it happens

Trigger: Passing --provides with an entry like 'libfoo (>= 1.0)' (only '=' allowed), 'a' (name too short), 'foo = bar baz' (bad spacing), or an entry with characters like commas or slashes that break the name pattern. Also hit when converting from another package type whose provides entries are copied verbatim with foreign syntax.

Common situations: Reusing RPM-style provides strings ('libfoo >= 1.0' without parentheses, or with >=) in a deb build; automating provides from dependency lists; copy-pasting Debian Depends syntax (which permits <, <=, >, >=) into --provides.

Related errors


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