Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix: fail proxy startup if prisma migrate fails

Harshit28j4714128da5f5
diff --git a/litellm/proxy/proxy_cli.py b/litellm/proxy/proxy_cli.py
index 921d86c35c1..5f6ccfd9ba3 100644
--- a/litellm/proxy/proxy_cli.py
+++ b/litellm/proxy/proxy_cli.py
@@ -853,7 +853,14 @@ def run_server( # noqa: PLR0915
):
check_prisma_schema_diff(db_url=None)
else:
- PrismaManager.setup_database(use_migrate=not use_prisma_db_push)
+ if not PrismaManager.setup_database(use_migrate=not use_prisma_db_push):
+ import sys
+
+ print( # noqa
+ "\033[1;31mLiteLLM Proxy: Database setup failed after multiple retries. "
+ "The proxy cannot start safely. Please check your database connection and migration status.\033[0m"
+ )
+ sys.exit(1)
else:
print( # noqa
f"Unable to connect to DB. DATABASE_URL found in environment, but prisma package not found." # noqa