ruby/rubygems · error · Gem::RemoteFetcher::FetchError

# : #

Error message

#{e.class}: #{e}

What it means

Error "#{e.class}: #{e}" thrown in ruby/rubygems.

Solutions

  1. Check network connectivity and proxy configuration, then retry
  2. The message includes the underlying exception class for diagnosis

When it happens

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

Appendix: source

Thrown at lib/rubygems/remote_fetcher.rb:274

      "https" => "fetch_http",
      "s3" => "fetch_s3",
      "file" => "fetch_file",
    }.fetch(uri.scheme) { raise ArgumentError, "uri scheme is invalid: #{uri.scheme.inspect}" }

    data = send method, uri, mtime, head

    if data && !head && uri.to_s.end_with?(".gz")
      begin
        data = Gem::Util.gunzip data
      rescue Zlib::GzipFile::Error
        raise FetchError.new("server did not return a valid file", uri)
      end
    end

    data
  rescue Gem::Timeout::Error, IOError, SocketError, SystemCallError,
         *(OpenSSL::SSL::SSLError if Gem::HAVE_OPENSSL) => e
    raise FetchError.new("#{e.class}: #{e}", uri)
  end

  def fetch_s3(uri, mtime = nil, head = false)
    begin
      public_uri = s3_uri_signer(uri, head ? "HEAD" : "GET").sign
    rescue Gem::S3URISigner::ConfigurationError, Gem::S3URISigner::InstanceProfileError => e
      raise FetchError.new(e.message, "s3://#{uri.host}")
    end
    fetch_https public_uri, mtime, head
  end

  # we have our own signing code here to avoid a dependency on the aws-sdk gem
  def s3_uri_signer(uri, method)
    Gem::S3URISigner.new(uri, method)
  end

  ##
  # Downloads +uri+ to +path+ if necessary. If no path is given, it just

View on GitHub (pinned to 86cbb817a3)