ruby/rubygems · error · Gem::Exception

malformed gem name: #{name.inspect}

Error message

malformed gem name: #{name.inspect}

What it means

Error "malformed gem name: #{name.inspect}" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/compact_index_client/cache.rb:84

        @special_characters_info_root.join(name)
      else
        @info_root.join(name)
      end
    end

    def info_etag_path(name)
      name = name.to_s
      validate_name!(name)
      @info_etag_root.join("#{name}-#{Digest::MD5.hexdigest(name).downcase}")
    end

    # Gem names come from the remote index and are not otherwise
    # validated, so refuse anything that would escape the cache
    # directory when used as a path component.
    def validate_name!(name)
      return if File.basename(name) == name

      raise Gem::Exception, "malformed gem name: #{name.inspect}"
    end

    def checksum_for_file(path)
      return unless path.file?
      Gem::CompactIndexClient.filesystem_access(path, :read) do
        Digest::MD5.file(path).hexdigest
      end
    end

    def mkdir(name)
      directory.join(name).tap do |dir|
        Gem::CompactIndexClient.filesystem_access(dir) do
          FileUtils.mkdir_p(dir)
        end
      end
    end

    def fetch(remote_path, path, etag_path)

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/rubygems/compact_index_client/cache.rb:84 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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