ruby/rubygems · error · Gem::InstallError

#{spec} has an invalid require_paths

Error message

#{spec} has an invalid require_paths

What it means

Error "#{spec} has an invalid require_paths" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/installer.rb:693

    unless path.include? user_bin_dir
      unless !Gem.win_platform? && (path.include? user_bin_dir.sub(ENV["HOME"], "~"))
        alert_warning "You don't have #{user_bin_dir} in your PATH,\n\t  gem executables (#{executables.join(", ")}) will not run."
      end
    end
  end

  def verify_gem_home # :nodoc:
    FileUtils.mkdir_p gem_home, mode: options[:dir_mode] && 0o755
  end

  def verify_spec
    unless Gem::Specification::VALID_NAME_PATTERN.match?(spec.name)
      raise Gem::InstallError, "#{spec} has an invalid name"
    end

    if spec.raw_require_paths.any? {|path| path =~ /\R/ }
      raise Gem::InstallError, "#{spec} has an invalid require_paths"
    end

    if spec.extensions.any? {|ext| ext =~ /\R/ }
      raise Gem::InstallError, "#{spec} has an invalid extensions"
    end

    unless /\A[\w.-]+\z/.match?(spec.platform.to_s)
      raise Gem::InstallError, "#{spec.platform} is an invalid platform"
    end

    unless /\A\d+\z/.match?(spec.specification_version.to_s)
      raise Gem::InstallError, "#{spec} has an invalid specification_version"
    end

    if spec.dependencies.any? {|dep| dep.type != :runtime && dep.type != :development }
      raise Gem::InstallError, "#{spec} has an invalid dependencies"
    end

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Set `spec.require_paths` to an array of existing directories (default: ['lib'])

When it happens

Trigger: Thrown at lib/rubygems/installer.rb:693 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/a758e75e515287e0. Report an issue: GitHub.