jordansissel/fpm · error · FPM::InvalidPackageConfiguration

Missing data.tar in deb source package #{package}

Error message

Missing data.tar in deb source package #{package}

What it means

When reading a .deb, fpm lists the ar members, takes the first entry matching data.tar to derive its compression, and maps gz/bzip2/xz/zst/tar. If it cannot determine any compression for the data member, it raises FPM::InvalidPackageConfiguration saying the data.tar is missing from the source package.

Source

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

    compression = `#{ar_cmd[0]} t #{package}`.split("\n").grep(/data.tar/).first.split(".").last
    case compression
      when "gz"
        datatar = "data.tar.gz"
        compression = "-z"
      when "bzip2","bz2"
        datatar = "data.tar.bz2"
        compression = "-j"
      when "xz"
        datatar = "data.tar.xz"
        compression = "-J"
      when "zst"
        datatar = "data.tar.zst"
        compression = "--use-compress-program 'zstd -d'"
      when 'tar'
        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)

View on GitHub (pinned to b6d77ba72a)

Solutions

  1. Confirm the member list: ar t package.deb (expect debian-binary, control.tar.*, data.tar.*)
  2. Re-download or rebuild the deb and retry the conversion
  3. Validate with dpkg-deb -c package.deb to see if dpkg can read the data member at all

Example fix

# before
fpm -s deb -t rpm truncated.deb

# after
apt-get download foo
fpm -s deb -t rpm foo_1.0_amd64.deb
Defensive patterns

Strategy: validation

Validate before calling

members = `ar t #{Shellwords.escape(path)}`.split("\n")
abort "no data.tar member in #{path}" unless members.any? { |m| m.start_with?('data.tar') }
# also sanity-check payload readability the way dpkg does:
system('dpkg-deb', '-c', path) || abort('dpkg cannot read data member either')

Type guard

def deb_with_data_member?(path)
  File.file?(path) && `ar t #{Shellwords.escape(path)} 2>/dev/null`.split("\n").any? { |m| m =~ /\Adata\.tar(\.|\z)/ }
end

Try / catch

begin
  pkg.input(deb_path)
rescue FPM::InvalidPackageConfiguration => e
  raise unless e.message =~ /Missing data.tar/
  abort "#{deb_path} is corrupt (no data.tar member) -- re-fetch the artifact"
end

Prevention

When it happens

Trigger: Converting a deb whose ar archive contains no recognizable data.tar.* member: corrupt/truncated .deb, a file that is not really a deb, or an ar archive where the data member is absent. Sibling error of the control.tar variant raised from extract_info.

Common situations: Partial downloads or interrupted artifact uploads; debs produced by nonstandard packagers that omit data.tar; files misnamed .deb; conversion of debs that failed mid-write on a full disk.

Related errors


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