ruby/rubygems · error · Gem::Exception

unable to find reference #{@reference} in #{@repository}

Error message

unable to find reference #{@reference} in #{@repository}

What it means

Error "unable to find reference #{@reference} in #{@repository}" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/source/git.rb:191

  ##
  # The directory where the git gem's repository will be cached.

  def repo_cache_dir # :nodoc:
    File.join @root_dir, "cache", "bundler", "git", "#{@name}-#{uri_hash}"
  end

  ##
  # Converts the git reference for the repository into a commit hash.

  def rev_parse # :nodoc:
    hash = nil

    Dir.chdir repo_cache_dir do
      hash = Gem::Util.popen(git_command, "rev-parse", @reference).strip
    end

    raise Gem::Exception,
          "unable to find reference #{@reference} in #{@repository}" unless
            $?.success?

    hash
  end

  ##
  # Loads all gemspecs in the repository

  def specs
    checkout

    return [] unless install_dir

    Dir.chdir install_dir do
      Dir["{,*,*/*}.gemspec"].filter_map do |spec_file|
        directory = File.dirname spec_file
        file      = File.basename spec_file

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Check that the branch/tag/reference exists in the git repository
  2. Run `gem sources`/`bundle config` to verify the repo URL, and fetch the reference

When it happens

Trigger: Thrown at lib/rubygems/source/git.rb:191 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/b264524e1961f535. Report an issue: GitHub.