diff --git a/litellm/proxy/management_endpoints/common_daily_activity.py b/litellm/proxy/management_endpoints/common_daily_activity.py index 329fef4260d..3a808327b8d 100644 --- a/litellm/proxy/management_endpoints/common_daily_activity.py +++ b/litellm/proxy/management_endpoints/common_daily_activity.py @@ -564,14 +564,10 @@ async def _get_deleted_keys_for_user( prisma_client: PrismaClient, user_id: str, ) -> Sequence["PrismaDeletedVerificationToken"]: - try: - return await DeletedVerificationTokenRepository(prisma_client).table.find_many( - where={"user_id": user_id}, # mutable-ok: Prisma query payload is consumed as a mutable mapping - order={"deleted_at": "desc"}, # mutable-ok: Prisma query payload is consumed as a mutable mapping - ) - except Exception as e: - verbose_proxy_logger.warning("Failed to fetch deleted key metadata for user %s: %s", user_id, e) - return () + return await DeletedVerificationTokenRepository(prisma_client).table.find_many( + where={"user_id": user_id}, # mutable-ok: Prisma query payload is consumed as a mutable mapping + order={"deleted_at": "desc"}, # mutable-ok: Prisma query payload is consumed as a mutable mapping + ) async def get_user_api_key_filter( diff --git a/tests/test_litellm/proxy/management_endpoints/test_common_daily_activity.py b/tests/test_litellm/proxy/management_endpoints/test_common_daily_activity.py index 84f9cc202de..9a61c7ac5dd 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_common_daily_activity.py +++ b/tests/test_litellm/proxy/management_endpoints/test_common_daily_activity.py @@ -355,7 +355,8 @@ async def test_get_user_api_key_filter_handles_deleted_lookup_failure_and_owned_ side_effect=RuntimeError("deleted-key table unavailable") ) - assert await get_user_api_key_filter(mock_prisma, "target-user", "active-key") == ["active-key"] + with pytest.raises(RuntimeError, match="deleted-key table unavailable"): + await get_user_api_key_filter(mock_prisma, "target-user", "active-key") @pytest.mark.asyncio