From 9cbf620e45e4f2d589fa0d51121a902334edf1fa Mon Sep 17 00:00:00 2001 From: Debanjum Date: Tue, 6 Jan 2026 12:13:35 -0800 Subject: [PATCH] Retry (with fallback) on Gemini fails with internal server error Khoj should use a fallback model when available to retry request if calls to Gemini fail with internal server error. --- src/khoj/processor/conversation/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/khoj/processor/conversation/utils.py b/src/khoj/processor/conversation/utils.py index dae182c2..36e82ba9 100644 --- a/src/khoj/processor/conversation/utils.py +++ b/src/khoj/processor/conversation/utils.py @@ -144,7 +144,7 @@ def is_retryable_exception(exception: BaseException) -> bool: # Google/Gemini exceptions if isinstance(exception, (gerrors.APIError, gerrors.ClientError)): # Check for specific error codes that are retryable - if hasattr(exception, "code") and exception.code in [429, 502, 503, 504]: + if hasattr(exception, "code") and exception.code in [429, 500, 502, 503, 504]: return True # Network errors