ruby/rubygems · error · GemspecError

There was an error while loading `#{path.basename}`: #{e.mes

Error message

There was an error while loading `#{path.basename}`: #{e.message}

What it means

Error "There was an error while loading `#{path.basename}`: #{e.message}" thrown in ruby/rubygems.

Source

Thrown at lib/bundler.rb:657

      Kernel.require "psych"

      Gem::Specification.from_yaml(contents)
    end

    def eval_gemspec(path, contents)
      if contents.start_with?("---") # YAML header
        eval_yaml_gemspec(path, contents)
      else
        # Eval the gemspec from its parent directory, because some gemspecs
        # depend on "./" relative paths.
        SharedHelpers.chdir(path.dirname.to_s) do
          eval(contents, TOPLEVEL_BINDING.dup, path.expand_path.to_s)
        end
      end
    rescue ScriptError, StandardError => e
      msg = "There was an error while loading `#{path.basename}`: #{e.message}"

      raise GemspecError, Dsl::DSLError.new(msg, path.to_s, e.backtrace, contents)
    end

    def configure_gem_path
      unless use_system_gems?
        # this needs to be empty string to cause
        # PathSupport.split_gem_path to only load up the
        # Bundler --path setting as the GEM_PATH.
        Bundler::SharedHelpers.set_env "GEM_PATH", ""
      end
    end

    def configure_gem_home(path)
      Bundler::SharedHelpers.set_env "GEM_HOME", path.to_s
    end

    def tmp_home_path
      Kernel.send(:require, "tmpdir")
      SharedHelpers.filesystem_access(Dir.tmpdir) do

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler.rb:657 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/2d205b1e99c4b5a4. Report an issue: GitHub.