ruby/rubygems · error · ArgumentError

unsupported URI scheme #{source_uri.scheme}

Error message

unsupported URI scheme #{source_uri.scheme}

What it means

Error "unsupported URI scheme #{source_uri.scheme}" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/remote_fetcher.rb:199

      source_path = if Gem.win_platform? && source_uri.scheme &&
                       !source_uri.path.include?(":")
        "#{source_uri.scheme}:#{source_uri.path}"
      else
        source_uri.path
      end

      source_path = Gem::UriFormatter.new(source_path).unescape

      begin
        FileUtils.cp source_path, local_gem_path unless
          File.identical?(source_path, local_gem_path)
      rescue Errno::EACCES
        local_gem_path = source_uri.to_s
      end

      verbose "Using local gem #{local_gem_path}"
    else
      raise ArgumentError, "unsupported URI scheme #{source_uri.scheme}"
    end

    local_gem_path
  end

  ##
  # File Fetcher. Dispatched by +fetch_path+. Use it instead.

  def fetch_file(uri, *_)
    Gem.read_binary Gem::Util.correct_for_windows_path uri.path
  end

  ##
  # HTTP Fetcher. Dispatched by +fetch_path+. Use it instead.

  def fetch_http(uri, last_modified = nil, head = false, depth = 0)
    fetch_type = head ? Gem::Net::HTTP::Head : Gem::Net::HTTP::Get
    response   = request uri, fetch_type, last_modified do |req|

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Use a source with an http://, https://, file://, or s3:// URI scheme

When it happens

Trigger: Thrown at lib/rubygems/remote_fetcher.rb:199 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/b53df3f7915d71d4. Report an issue: GitHub.