ruby/rubygems · error · Bundler::GemRequireError

24

24

Error message

There was an error while trying to load the gem '#{file}'.

What it means

Error "There was an error while trying to load the gem '#{file}'." thrown in ruby/rubygems.

Source

Thrown at lib/bundler/runtime.rb:71

        Plugin.hook(Plugin::Events::GEM_BEFORE_REQUIRE, dep)

        # Loop through all the specified autorequires for the
        # dependency. If there are none, use the dependency's name
        # as the autorequire.
        Array(dep.autorequire || dep.name).each do |file|
          # Allow `require: true` as an alias for `require: <name>`
          file = dep.name if file == true
          required_file = file
          begin
            Kernel.require required_file
          rescue LoadError => e
            if dep.autorequire.nil? && e.path == required_file
              if required_file.include?("-")
                required_file = required_file.tr("-", "/")
                retry
              end
            else
              raise Bundler::GemRequireError.new e,
                "There was an error while trying to load the gem '#{file}'."
            end
          rescue StandardError => e
            raise Bundler::GemRequireError.new e,
              "There was an error while trying to load the gem '#{file}'."
          end
        end

        Plugin.hook(Plugin::Events::GEM_AFTER_REQUIRE, dep)
      end

      Plugin.hook(Plugin::Events::GEM_AFTER_REQUIRE_ALL, dependencies)

      dependencies
    end

    def self.definition_method(meth)
      define_method(meth) do

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler/runtime.rb:71 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/1ddabe5df38e2fa9. Report an issue: GitHub.