Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Exception: NoMethodError: undefined method `include?' for nil - in lib/net/http.rb:2466

Open
#184 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
ruby
Domain
networking

Research direction

Start in lib/net/http.rb:2466 at addr_port, then trace address through begin_transport and request using the Faraday/net_http call path shown in the stack trace. Determine where nil enters this path and establish the intended failure behavior; done when the nil case is handled consistently and a regression check covers it.

Written by the indexing model from the issue text.

Description

I'm getting:

Exception: NoMethodError: undefined method `include?' for nil

Here:

vendor/bundle/ruby/3.3.0/gems/net-http-0.4.1/lib/net/http.rb:2466:in `addr_port'
vendor/bundle/ruby/3.3.0/gems/net-http-0.4.1/lib/net/http.rb:2401:in `begin_transport'
vendor/bundle/ruby/3.3.0/gems/net-http-0.4.1/lib/net/http.rb:2332:in `transport_request'
vendor/bundle/ruby/3.3.0/gems/net-http-0.4.1/lib/net/http.rb:2306:in `request'
vendor/bundle/ruby/3.3.0/gems/airbrake-13.0.4/lib/airbrake/rails/net_http.rb:11:in `block in request'
vendor/bundle/ruby/3.3.0/gems/airbrake-13.0.4/lib/airbrake/rack.rb:21:in `capture_timing'
vendor/bundle/ruby/3.3.0/gems/airbrake-13.0.4/lib/airbrake/rails/net_http.rb:10:in `request'
vendor/bundle/ruby/3.3.0/gems/faraday-net_http-3.3.0/lib/faraday/adapter/net_http.rb:112:in `block in request_with_wrapped_block'
vendor/bundle/ruby/3.3.0/gems/net-http-0.4.1/lib/net/http.rb:1570:in `start'
vendor/bundle/ruby/3.3.0/gems/faraday-net_http-3.3.0/lib/faraday/adapter/net_http.rb:111:in `request_with_wrapped_block'
vendor/bundle/ruby/3.3.0/gems/faraday-net_http-3.3.0/lib/faraday/adapter/net_http.rb:101:in `perform_request'
vendor/bundle/ruby/3.3.0/gems/faraday-net_http-3.3.0/lib/faraday/adapter/net_http.rb:65:in `block in call'
vendor/bundle/ruby/3.3.0/gems/faraday-2.11.0/lib/faraday/adapter.rb:45:in `connection'
vendor/bundle/ruby/3.3.0/gems/faraday-net_http-3.3.0/lib/faraday/adapter/net_http.rb:64:in `call'
vendor/bundle/ruby/3.3.0/gems/faraday-2.11.0/lib/faraday/middleware.rb:56:in `call'
vendor/bundle/ruby/3.3.0/gems/faraday-2.11.0/lib/faraday/rack_builder.rb:152:in `build_response'
vendor/bundle/ruby/3.3.0/gems/faraday-2.11.0/lib/faraday/connection.rb:452:in `run_request'
vendor/bundle/ruby/3.3.0/gems/faraday-2.11.0/lib/faraday/connection.rb:200:in `get'

This is the code responsible:

    def addr_port
      addr = address
      addr = "[#{addr}]" if addr.include?(":") # the .include? here
      default_port = use_ssl? ? HTTP.https_default_port : HTTP.http_default_port
      default_port == port ? addr : "#{addr}:#{port}"
    end

It seems there should be some kind of validation earlier to avoid this?

Dominant language
Ruby
Stars
148
Forks
95
Avg merge
10h 54m
Merged PRs (30d)
4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ruby/net-http

All issues in ruby/net-http

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.