{"record":{"id":"21e594eb57ec7f38","repo":"SeleniumHQ/selenium","slug":"unable-to-connect-to-executable-path-host","errorCode":null,"errorMessage":"unable to connect to #{@executable_path} #{@host}:#{@port}: #{error}","messagePattern":"unable to connect to #(.+?) #(.+?):#(.+?): #(.+?)","errorType":"exception","errorClass":"Error::WebDriverError","httpStatus":null,"severity":"critical","filePath":"rb/lib/selenium/webdriver/common/service_manager.rb","lineNumber":142,"sourceCode":"        end\n      end\n\n      def process_running?\n        defined?(@process) && @process&.alive?\n      end\n\n      def process_exited?\n        @process.nil? || @process.exited?\n      end\n\n      def connect_until_stable\n        deadline = current_time + START_TIMEOUT\n\n        loop do\n          error = check_connection_error\n          return unless error\n\n          raise Error::WebDriverError, \"#{cannot_connect_error_text}: #{error}\" if current_time > deadline\n\n          sleep 0.1\n        end\n      end\n\n      def check_connection_error\n        response = Net::HTTP.start(@host, @port, open_timeout: 0.5, read_timeout: 1) do |http|\n          http.get('/status', {'Connection' => 'close'})\n        end\n\n        return \"status returned #{response.code}\\n#{response.body}\" unless response.is_a?(Net::HTTPSuccess)\n\n        status = JSON.parse(response.body)\n        ready = status['ready'] || status.dig('value', 'ready')\n        \"driver not ready: #{response.body}\" unless ready\n      rescue Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::EPIPE, Errno::ETIMEDOUT,\n             Errno::EADDRNOTAVAIL, Errno::EHOSTUNREACH, Net::OpenTimeout, Net::ReadTimeout,\n             EOFError, SocketError, Net::HTTPBadResponse, JSON::ParserError => e","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/rb/lib/selenium/webdriver/common/service_manager.rb#L124-L160","documentation":"Raised by ServiceManager#connect_until_stable when the driver server process has been launched but does not respond with a ready status at /status within START_TIMEOUT (20 seconds). The method polls /status every 0.1s; if the endpoint never returns a successful HTTP response with ready: true before the deadline, it raises WebDriverError with the last connection error appended.","triggerScenarios":"The driver binary (chromedriver, geckodriver, etc.) starts but crashes immediately or hangs. The driver binary version is incompatible with the browser version. The driver binary requires specific flags not provided. Port contention where another process interferes. The driver is slow to start (heavy I/O, slow disk) and exceeds 20s. SELinux or firewall blocking localhost connections.","commonSituations":"Chrome browser updated but chromedriver is still the old version (session creation fails). Running under Docker with limited resources causing slow startup. Driver binary for wrong architecture (e.g., ARM binary on x86). Missing shared libraries for the driver binary (it starts then segfaults).","solutions":["Check the driver version matches the browser version (e.g., chromedriver --version vs chrome --version).","Enable driver logging: pass log: $stdout or set SE_DEBUG=1 to see the driver's own error output.","Increase startup timeout is not directly exposed; instead, verify the driver binary works standalone by running it manually: chromedriver --port=9515 and curl http://localhost:9515/status.","Ensure the correct architecture binary is installed (x86_64 vs ARM64).","Check for missing shared libraries: ldd /path/to/driver.","Use Selenium Manager or specify a known-good driver_path explicitly."],"exampleFix":"// before\nservice = Selenium::WebDriver::Service.chrome\ndriver = Selenium::WebDriver.for :chrome, service: service\n# fails: unable to connect to chromedriver\n\n// after (enable logging + explicit driver)\nservice = Selenium::WebDriver::Service.chrome(\n  driver_path: '/usr/local/bin/chromedriver-120',\n  log: $stdout\n)\ndriver = Selenium::WebDriver.for :chrome, service: service","handlingStrategy":"retry","validationCode":"# Pre-test: verify driver binary works standalone\ndef driver_responds?(driver_path, port = 9515)\n  pid = spawn(driver_path, \"--port=#{port}\")\n  sleep 2\n  ready = begin\n    response = Net::HTTP.get(URI(\"http://localhost:#{port}/status\"))\n    JSON.parse(response)['value']['ready']\n  rescue StandardError\n    false\n  end\n  Process.kill('TERM', pid) rescue nil\n  Process.wait(pid) rescue nil\n  ready\nend","typeGuard":null,"tryCatchPattern":"attempts = 0\nbegin\n  attempts += 1\n  driver = Selenium::WebDriver.for :chrome\nrescue Selenium::WebDriver::Error::WebDriverError => e\n  raise unless e.message.include?('unable to connect') && attempts < 3\n  warn \"Driver startup failed (attempt #{attempts}), retrying... #{e.message}\"\n  sleep 2\n  retry\nend","preventionTips":["Ensure browser and driver versions are matched before running tests.","Enable driver logging (log: $stdout or SE_DEBUG=1) to capture driver-side errors.","Run driver.quit in an ensure block / at_exit to prevent orphaned processes.","In CI, add a pre-flight check that verifies the driver binary executes successfully."],"tags":["service-manager","driver-startup","connection","timeout","ruby"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}