ruby/rubygems · error · Gem::Package::FormatError

#{name} is too big (over #{limit} bytes)

Error message

#{name} is too big (over #{limit} bytes)

What it means

Error "#{name} is too big (over #{limit} bytes)" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/package.rb:750

    if (duplicates = @files.group_by {|f| f }.select {|_k,v| v.size > 1 }.map(&:first)) && duplicates.any?
      raise Gem::Security::Exception, "duplicate files in the package: (#{duplicates.map(&:inspect).join(", ")})"
    end
  end

  if RUBY_ENGINE == "truffleruby"
    def copy_stream(src, dst, size) # :nodoc:
      dst.write src.read(size)
    end
  else
    def copy_stream(src, dst, size) # :nodoc:
      IO.copy_stream(src, dst, size)
    end
  end

  def limit_read(io, name, limit)
    bytes = io.read(limit + 1)
    raise Gem::Package::FormatError, "#{name} is too big (over #{limit} bytes)" if bytes.size > limit
    bytes
  end

  if Gem.win_platform?
    # Create a symlink and fallback to copy the file or directory on Windows,
    # where symlink creation needs special privileges in form of the Developer Mode.
    # JRuby on Windows raises TypeError from the wincode path-conversion helper
    # when it cannot create the symlink, so fall back to copy in that case too.
    def create_symlink(old_name, new_name)
      File.symlink(old_name, new_name)
    rescue Errno::EACCES, TypeError
      from = File.expand_path(old_name, File.dirname(new_name))
      FileUtils.cp_r(from, new_name)
    end
  else
    def create_symlink(old_name, new_name)
      File.symlink(old_name, new_name)
    end

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Reduce the size of the named file in the package below the limit and rebuild the gem

When it happens

Trigger: Thrown at lib/rubygems/package.rb:750 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruby/rubygems@86cbb817a3 (2026-08-23). Data as JSON: /api/errors/32cd5fbf37c5fb1a. Report an issue: GitHub.