From b073e41230bdb297616270ef16aa92b601a8579c Mon Sep 17 00:00:00 2001 From: AryanMishra17003 <158508418+AryanMishra17003@users.noreply.github.com> Date: Tue, 17 Feb 2026 21:43:15 +0530 Subject: [PATCH] Prevent Keyman crash on uninitialized platform during startup Signed-off-by: AryanMishra17003 <158508418+AryanMishra17003@users.noreply.github.com> --- keyman/Orchestrator.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/keyman/Orchestrator.py b/keyman/Orchestrator.py index 220776063f..a45102de53 100644 --- a/keyman/Orchestrator.py +++ b/keyman/Orchestrator.py @@ -12,7 +12,12 @@ sys.path.append("/augur") - conn = redis.Redis.from_url(os.environ.get("REDIS_CONN_STRING")) + # Only create a Redis connection if a connection string is provided. + redis_url = os.environ.get("REDIS_CONN_STRING") + if redis_url: + conn = redis.Redis.from_url(redis_url) + else: + conn = None # Just log to stdout if we're running in docker logger = logging.Logger("KeyOrchestrator") @@ -151,7 +156,10 @@ def new_key(self, platform: str) -> str | None: WaitKeyTimeout: If no fresh keys available (includes wait duration) """ if platform not in self.fresh_keys: - raise InvalidRequest(f"Invalid platform: {platform}") + self.logger.warning( + f"Key requested for uninitialized platform '{platform}'; this may occur during startup after state cleanup." + ) + return if not len(self.fresh_keys[platform]): if not len(self.expired_keys[platform]):