jordansissel/fpm · error · FPM::InvalidPackageConfiguration

Tried to treat #{readable_path} like a directory, but it's a

Error message

Tried to treat #{readable_path} like a directory, but it's a file!

What it means

Error "Tried to treat #{readable_path} like a directory, but it's a file!" thrown in jordansissel/fpm.

Source

Thrown at lib/fpm/package/dir.rb:179

  # Copy a path.
  #
  # Files will be hardlinked if possible, but copied otherwise.
  # Symlinks should be copied as symlinks.
  def copy(source, destination)
    logger.debug("Copying path", :source => source, :destination => destination)
    directory = File.dirname(destination)
    # lstat to follow symlinks
    dstat = File.stat(directory) rescue nil
    if dstat.nil?
      FileUtils.mkdir_p(directory, :mode => 0755)
    elsif dstat.directory?
      # do nothing, it's already a directory!
    else
      # It exists and is not a directory. This is probably a user error or a bug.
      readable_path = directory.gsub(staging_path, "")
      logger.error("You wanted to copy a file into a directory, but that's not a directory, it's a file!", :path => readable_path, :stat => dstat)
      raise FPM::InvalidPackageConfiguration, "Tried to treat #{readable_path} like a directory, but it's a file!"
    end

    if File.directory?(source)
      if !File.symlink?(source)
        # Create a directory if this path is a directory
        logger.debug("Creating", :directory => destination)
        if !File.directory?(destination)
          FileUtils.mkdir(destination)
        end
      else
        # Linking symlinked directories causes a hardlink to be created, which
        # results in the source directory being wiped out during cleanup,
        # so copy the symlink.
        logger.debug("Copying symlinked directory", :source => source,
                      :destination => destination)
        FileUtils.copy_entry(source, destination)
      end
    else

View on GitHub (pinned to b6d77ba72a)

When it happens

Trigger: Thrown at lib/fpm/package/dir.rb:179 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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