From 0f4c872c72d8491c41af48e6d7a453e197869537 Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Fri, 7 Aug 2026 00:20:42 +0200 Subject: [PATCH] fix(deps): use NULLIF for tenant_id cast in plugin activation check current_setting returns empty string when tenant context is not set. Casting empty string to uuid fails. Use NULLIF to convert to NULL. --- app/deps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/deps.py b/app/deps.py index 74ecf16..722ecdd 100644 --- a/app/deps.py +++ b/app/deps.py @@ -391,7 +391,7 @@ def require_active_plugin(plugin_name: str): from sqlalchemy import text as sa_text result = await db.execute( - sa_text("SELECT current_setting('app.current_tenant_id', true)::uuid") + sa_text("SELECT NULLIF(current_setting('app.current_tenant_id', true), '')::uuid") ) tenant_id = result.scalar()