From a185dc252b4116a84d2a22459069b2d8573b869d Mon Sep 17 00:00:00 2001 From: Shoubhit Dash Date: Thu, 30 Oct 2025 14:59:31 +0530 Subject: [PATCH] fix event loop exception handling to not mask legitimate errors --- packages/openai-sdk-python/src/supermemory_openai/wrapper.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/openai-sdk-python/src/supermemory_openai/wrapper.py b/packages/openai-sdk-python/src/supermemory_openai/wrapper.py index 4a023c02..4c8131a9 100644 --- a/packages/openai-sdk-python/src/supermemory_openai/wrapper.py +++ b/packages/openai-sdk-python/src/supermemory_openai/wrapper.py @@ -260,7 +260,9 @@ class SupermemorySyncChatCompletions: "Cannot use sync client from within an async context. " "Use AsyncOpenAI with with_supermemory instead." ) - except RuntimeError: + except RuntimeError as e: + if "Cannot use sync client" in str(e): + raise # No running loop, safe to use asyncio.run return asyncio.run(self.wrapper._process_chat_completion(**kwargs))