jordansissel/fpm · error · NotImplementedError

#{self.class.name} does not yet support reading #{self.type}

Error message

#{self.class.name} does not yet support reading #{self.type} packages

What it means

FPM::Package#input is the abstract 'read a package of this type' hook that every format subclass must override. When a format class never implements it (fpm can create that type but cannot consume it), the base method raises NotImplementedError naming the class and type, e.g. 'FPM::Package::Virtualenv does not yet support reading virtualenv packages'. This is a capability gap of the format plugin, not a runtime fault in your package data.

Source

Thrown at lib/fpm/package.rb:245

    # nothing to do by default. Subclasses may implement this.
    # See the RPM package class for an example.
  end # def converted_from

  # Add a new source to this package.
  # The exact behavior depends on the kind of package being managed.
  #
  # For instance:
  #
  # * for FPM::Package::Dir, << expects a path to a directory or files.
  # * for FPM::Package::RPM, << expects a path to an rpm.
  #
  # The idea is that you can keep pumping in new things to a package
  # for later conversion or output.
  #
  # Implementations are expected to put files relevant to the 'input' in the
  # staging_path
  def input(thing_to_input)
    raise NotImplementedError.new("#{self.class.name} does not yet support " \
                                  "reading #{self.type} packages")
  end # def input

  # Output this package to the given path.
  def output(path)
    raise NotImplementedError.new("#{self.class.name} does not yet support " \
                                  "creating #{self.type} packages")
  end # def output

  def staging_path(path=nil)
    @staging_path ||= Stud::Temporary.directory("package-#{type}-staging")

    if path.nil?
      return @staging_path
    else
      return File.join(@staging_path, path)
    end
  end # def staging_path

View on GitHub (pinned to b6d77ba72a)

Solutions

  1. Switch to a readable input type: unpack the artifact and run 'fpm -s dir -t <target> <unpacked-dir>'
  2. Check FPM::Package.types (or 'fpm --help') to confirm the chosen type actually defines input before scripting conversions
  3. If you own the subclass, implement def input(thing) to populate staging_path, or raise your own descriptive error to make the gap explicit

Example fix

# before
fpm -s virtualenv -t deb ./myvenv   # => NotImplementedError: ...reading virtualenv packages

# after: package the virtualenv contents as a plain directory tree
fpm -s dir -t deb ./myvenv
Defensive patterns

Strategy: validation

Validate before calling

require 'fpm/package'

def fpm_can_read?(type)
  klass = FPM::Package.types[type.to_s]
  !klass.nil? && klass.instance_method(:input).owner != FPM::Package
end

abort 'fpm cannot read this package type' unless fpm_can_read?('deb')

Try / catch

begin
  pkg.input(artifact)
rescue NotImplementedError => e
  warn "#{pkg.class} has no reader (#{e.message}); unpack it and use FPM::Package::Dir instead"
  raise
end

Prevention

When it happens

Trigger: Calling pkg.input(path) on a format class that only implements output, or running 'fpm -s virtualenv -t deb ...' / 'fpm -s pleaserun ...' where the -s type is output-only. Also raised when a custom subclass registered with FPM::Package forgets to define def input.

Common situations: Assuming every fpm type is round-trippable and trying to convert FROM an output-only format (virtualenv, pleaserun-style); typos in -s/--input-type that resolve to the wrong registered class; writing custom format plugins and forgetting the reader half.

Related errors


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