ruby/rubygems · error · ArgumentError

The source must be an absolute URI. For example: source 'htt

Error message

The source must be an absolute URI. For example:
source 'https://rubygems.org'

What it means

Error "The source must be an absolute URI. For example: source 'https://rubygems.org'" thrown in ruby/rubygems.

Source

Thrown at lib/bundler/source/rubygems.rb:373

      end

      def cached_gem(spec)
        global_cache_path = download_cache_path(spec)
        caches << global_cache_path if global_cache_path

        possibilities = caches.map {|p| package_path(p, spec) }
        possibilities.find {|p| File.exist?(p) }
      end

      def package_path(cache_path, spec)
        "#{cache_path}/#{spec.file_name}"
      end

      def normalize_uri(uri)
        uri = URINormalizer.normalize_suffix(uri.to_s)
        require_relative "../vendored_uri"
        uri = Gem::URI(uri)
        raise ArgumentError, "The source must be an absolute URI. For example:\n" \
          "source 'https://rubygems.org'" if !uri.absolute? || (uri.is_a?(Gem::URI::HTTP) && uri.host.nil?)
        uri
      end

      def remove_auth(remote)
        if remote.user || remote.password
          remote.dup.tap {|uri| uri.user = uri.password = nil }.to_s
        else
          remote.to_s
        end
      end

      def installed_specs
        @installed_specs ||= Index.build do |idx|
          Bundler.rubygems.installed_specs.reverse_each do |spec|
            spec.source = self
            next if spec.ignored?
            idx << spec

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler/source/rubygems.rb:373 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/5cb61c31efea4c99. Report an issue: GitHub.