{"record":{"id":"195563bd0fe9ed25","repo":"SeleniumHQ/selenium","slug":"remote-server-not-ready-in-seconds","errorCode":null,"errorMessage":"remote server not ready in {} seconds","messagePattern":"remote server not ready in (.+?) seconds","errorType":"exception","errorClass":"Selenium::Server::Error","httpStatus":null,"severity":"error","filePath":"rb/lib/selenium/server.rb","lineNumber":281,"sourceCode":"        if @log.is_a?(String)\n          cp.io = @log\n        elsif @log\n          cp.io = :out\n        end\n\n        cp.detach = @background\n\n        cp\n      end\n    end\n\n    def poll_for_ready\n      start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n      loop do\n        return if status_ok?\n\n        elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start_time\n        raise Error, \"remote server not ready in #{@timeout} seconds\" if elapsed > @timeout\n\n        sleep 0.5\n      end\n    end\n\n    def socket_connected?\n      @socket_connected ||= socket.connected?\n    end\n\n    def poll_for_shutdown\n      return if socket.closed?\n\n      raise Error, \"remote server not stopped in #{@timeout} seconds\"\n    end\n\n    def socket\n      @socket ||= WebDriver::SocketPoller.new(@host, @port, @timeout)\n    end","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/rb/lib/selenium/server.rb#L263-L299","documentation":"Raised by Selenium::Server#poll_for_ready (server.rb:281) when the server has not returned a healthy status before @timeout seconds elapse. It polls status_ok? every 0.5s and gives up once elapsed exceeds the configured timeout (default 30s).","triggerScenarios":"poll_for_ready loops; status_ok? never becomes true within @timeout (default 30) seconds, so it raises 'remote server not ready in N seconds'.","commonSituations":"Slow/CPU-constrained CI; Java missing or wrong version; port 4444 already in use; the server crashed during startup (check the server log); a large Grid startup under memory pressure.","solutions":["Increase the timeout: Selenium::Server.new(jar, timeout: 120).","Inspect the server log (pass log: 'server.log' or log: true) for the startup error.","Ensure the port is free and Java is on PATH with a compatible version.","Run the server in the foreground (background: false) to see the failure immediately."],"exampleFix":"# before\nserver = Selenium::Server.new(jar, background: true)              # default timeout 30\n# after\nserver = Selenium::Server.new(jar, background: true, timeout: 120, log: true)","handlingStrategy":"retry","validationCode":"require 'socket'\nraise 'port 4444 already in use' if TCPSocket.new('127.0.0.1', 4444)\n# and ensure java is present:\nraise 'java not on PATH' unless system('java -version', out: '/dev/null', err: '/dev/null')","typeGuard":null,"tryCatchPattern":"begin\n  server = Selenium::Server.new(jar, background: true, timeout: 120, log: true)\n  server.start\nrescue Selenium::Server::Error => e\n  raise unless e.message.include?('not ready')\n  raise \"server failed to start; see #{server.log}\"\nend","preventionTips":["Increase timeout: on slow/CI hosts (e.g. timeout: 120).","Ensure the port is free and Java is on PATH with a compatible version.","Run with log: true and inspect the server log when startup fails."],"tags":["server","timeout","startup","ruby"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}