ruby/rubygems · error · Bundler::InstallError

5

5

Error message

#{spec.full_name} requires ruby version #{spec.required_ruby_version}, which is incompatible with the current version, #{Gem.ruby_version}

What it means

Error "#{spec.full_name} requires ruby version #{spec.required_ruby_version}, which is incompatible with the current version, #{Gem.ruby_version}" thrown in ruby/rubygems.

Source

Thrown at lib/bundler/installer.rb:234

    def load_plugins
      Gem.load_plugins

      requested_path_gems = @definition.specs.select {|s| s.source.is_a?(Source::Path) }
      path_plugin_files = requested_path_gems.flat_map do |spec|
        spec.matches_for_glob("rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
      rescue TypeError
        error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
        raise Gem::InvalidSpecificationException, error_message
      end
      Gem.load_plugin_files(path_plugin_files)
      Gem.load_env_plugins
    end

    def ensure_specs_are_compatible!
      overrides = @definition.overrides
      @definition.specs.each do |spec|
        unless spec.matches_current_ruby_with_overrides?(overrides)
          raise InstallError, incompatibility_message(spec, "requires ruby version #{spec.required_ruby_version}, " \
            "which is incompatible with the current version, #{Gem.ruby_version}")
        end
        unless spec.matches_current_rubygems_with_overrides?(overrides)
          raise InstallError, incompatibility_message(spec, "requires rubygems version #{spec.required_rubygems_version}, " \
            "which is incompatible with the current version, #{Gem.rubygems_version}")
        end
      end
    end

    # Build the error raised when a locked spec can't run on the current Ruby or
    # RubyGems. When the offending spec is a platform-specific variant locked in
    # frozen mode, point users at the fix: re-resolving outside frozen mode adds
    # the Ruby (non platform-specific) fallback variant to the lockfile.
    def incompatibility_message(spec, reason)
      message = "#{spec.full_name} #{reason}"
      return message unless Bundler.frozen_bundle? && spec.platform != Gem::Platform::RUBY

      message + "\n\nThe lockfile only includes the #{spec.platform} variant of #{spec.name}. " \

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler/installer.rb:234 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/4200032ff15206e0. Report an issue: GitHub.