BerriAI/litellm · error · HTTPException
Invalid limit: {limit}, error: {e}
Error message
Invalid limit: {limit}, error: {e} What it means
Error "Invalid limit: {limit}, error: {e}" thrown in BerriAI/litellm.
Source
Thrown at litellm/proxy/spend_tracking/spend_management_endpoints.py:3439
):
response = await global_spend_key_internal_user(user_api_key_dict=user_api_key_dict)
return response
if prisma_client is None:
raise HTTPException(status_code=500, detail={"error": "No db connected"})
sql_query = """SELECT * FROM "Last30dKeysBySpend";"""
if limit is None:
response = await _query_raw(prisma_client, sql_query)
return response
try:
limit = int(limit)
if limit < 1:
raise ValueError("Limit must be greater than 0")
sql_query = """SELECT * FROM "Last30dKeysBySpend" LIMIT $1 ;"""
response = await _query_raw(prisma_client, sql_query, limit)
except ValueError as e:
raise HTTPException(status_code=422, detail={"error": f"Invalid limit: {limit}, error: {e}"}) from e
return response
@router.get(
"/global/spend/teams",
tags=["Budget & Spend Tracking"],
dependencies=[Depends(user_api_key_auth)],
include_in_schema=False,
)
async def global_spend_per_team():
"""
[BETA] This is a beta endpoint. It will change.
Use this to get daily spend, grouped by `team_id` and `date`
"""
from litellm.proxy.proxy_server import prisma_client
View on GitHub (pinned to 77b7c6c40c)
Solutions
- Pass limit as a plain integer string (e.g., ?limit=50); the value could not be parsed.
- Check for surrounding whitespace or non-numeric characters in the limit value.
When it happens
Trigger: Thrown at litellm/proxy/spend_tracking/spend_management_endpoints.py:3439 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/7616db0260902124.
Report an issue: GitHub.