From fa89efcf1d766bda771e42605bfb63d41dc04762 Mon Sep 17 00:00:00 2001 From: Chessing234 Date: Fri, 17 Apr 2026 13:23:11 +0530 Subject: [PATCH] Return after yielding no-worker error in worker_api_generate_stream If get_worker_address returns an empty string, Controller.worker_api_generate_stream yields the CONTROLLER_NO_WORKER error and then falls through into the request block. With worker_addr == "" the subsequent requests.post("" + "/worker_generate_stream", ...) has no scheme/host and raises requests.exceptions.RequestException, which the except branch translates into a second yield of CONTROLLER_WORKER_TIMEOUT addressed to the empty worker address. Clients end up seeing two unrelated error chunks for the same request, and the logs record a misleading "worker timeout" for a worker that never existed. Add a return after the no-worker yield so the generator stops after reporting the real problem, matching the single-error contract expected by the stream consumer and the sibling handle_worker_timeout path. --- fastchat/serve/controller.py | 1 + 1 file changed, 1 insertion(+) diff --git a/fastchat/serve/controller.py b/fastchat/serve/controller.py index 42d928403..d16e03d9d 100644 --- a/fastchat/serve/controller.py +++ b/fastchat/serve/controller.py @@ -267,6 +267,7 @@ def worker_api_generate_stream(self, params): worker_addr = self.get_worker_address(params["model"]) if not worker_addr: yield self.handle_no_worker(params) + return try: response = requests.post(