Skip to content

unknown keyword :open_timeout #264

Closed

Description

@aaronrosenthal

Problem

net-http is sometimes throwing an ArgumentError due to an incorrectly named positional argument (open_timeout).

Context

This issue was discovered while testing some calls with the graphql-client gem in situations where there were network connectivity errors. net-http would raise with a SocketError but also an ArgumentError because of an incorrectly named positional argument:

/app/vendor/bundle/ruby/3.2.0/gems/net-http-0.8.0/lib/net/http.rb:1682:in `initialize': unknown keyword: :open_timeout (ArgumentError)

              sock = TCPSocket.open(conn_addr, conn_port, @local_host, @local_port, open_timeout: @open_timeout)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	from /app/vendor/bundle/ruby/3.2.0/gems/net-http-0.8.0/lib/net/http.rb:1682:in `open'

Solution

Looking at https://ruby-doc.org/stdlib-2.6.1/libdoc/socket/rdoc/Socket.html#method-c-tcp, I believe the fix is to simply change the name of the positional argument to connect_timeout:

TCPSocket.open(conn_addr, conn_port, @local_host, @local_port, connect_timeout: @open_timeout)

Activity

  1. shioimm commented on Jan 12, 2026

    @shioimm
    Contributor

    It seems that the issue you are encountering has been fixed in #252 .
    If you are able to upgrade net-http to version 0.9.1, doing so may resolve this problem.

  2. aaronrosenthal commented on Feb 6, 2026

    @aaronrosenthal
    Author

    Thanks @shioimm. That looks right. Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions