ruby/rubygems · error

Ruby net/http: failed Unfortunately, this Ruby can't connec

Error message

Ruby net/http: failed

Unfortunately, this Ruby can't connect to #{host}.

#{Explanation.explain_net_http_error(error, host, tls_version)}

What it means

Error "Ruby net/http: failed Unfortunately, this Ruby can't connect to #{host}. #{Explanation.explain_net_http_error(error, host, tls_version)}" thrown in ruby/rubygems.

Source

Thrown at lib/bundler/cli/doctor/ssl.rb:112

      Bundler.ui.warn("RubyGems:      failed     (#{Explanation.explain_bundler_or_rubygems_error(error)})")

      false
    end

    def net_http_connection_successful?
      ::Gem::Net::HTTP.new(uri.host, uri.port).tap do |http|
        http.use_ssl = true
        http.min_version = tls_version
        http.max_version = tls_version
        http.verify_mode = verify_mode
      end.start

      Bundler.ui.info("Ruby net/http: success")
      warn_on_unsupported_tls12

      true
    rescue StandardError => error
      Bundler.ui.warn(<<~MSG)
        Ruby net/http: failed

        Unfortunately, this Ruby can't connect to #{host}.

        #{Explanation.explain_net_http_error(error, host, tls_version)}
      MSG

      false
    end

    def warn_on_unsupported_tls12
      ctx = OpenSSL::SSL::SSLContext.new
      supported = true

      if ctx.respond_to?(:min_version=)
        begin
          ctx.min_version = ctx.max_version = OpenSSL::SSL::TLS1_2_VERSION
        rescue OpenSSL::SSL::SSLError, NameError

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Follow the printed explanation: usually update CA certificates and/or upgrade OpenSSL for the required TLS version

When it happens

Trigger: Thrown at lib/bundler/cli/doctor/ssl.rb:112 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/90e61402f382cb27. Report an issue: GitHub.