{"record":{"id":"7616db0260902124","repo":"BerriAI/litellm","slug":"invalid-limit-limit-error-e","errorCode":null,"errorMessage":"Invalid limit: {limit}, error: {e}","messagePattern":"Invalid limit: (.+?), error: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":422,"severity":"error","filePath":"litellm/proxy/spend_tracking/spend_management_endpoints.py","lineNumber":3439,"sourceCode":"    ):\n        response = await global_spend_key_internal_user(user_api_key_dict=user_api_key_dict)\n\n        return response\n    if prisma_client is None:\n        raise HTTPException(status_code=500, detail={\"error\": \"No db connected\"})\n    sql_query = \"\"\"SELECT * FROM \"Last30dKeysBySpend\";\"\"\"\n\n    if limit is None:\n        response = await _query_raw(prisma_client, sql_query)\n        return response\n    try:\n        limit = int(limit)\n        if limit < 1:\n            raise ValueError(\"Limit must be greater than 0\")\n        sql_query = \"\"\"SELECT * FROM \"Last30dKeysBySpend\" LIMIT $1 ;\"\"\"\n        response = await _query_raw(prisma_client, sql_query, limit)\n    except ValueError as e:\n        raise HTTPException(status_code=422, detail={\"error\": f\"Invalid limit: {limit}, error: {e}\"}) from e\n\n    return response\n\n\n@router.get(\n    \"/global/spend/teams\",\n    tags=[\"Budget & Spend Tracking\"],\n    dependencies=[Depends(user_api_key_auth)],\n    include_in_schema=False,\n)\nasync def global_spend_per_team():\n    \"\"\"\n    [BETA] This is a beta endpoint. It will change.\n\n    Use this to get daily spend, grouped by `team_id` and `date`\n    \"\"\"\n    from litellm.proxy.proxy_server import prisma_client\n","sourceCodeStart":3421,"sourceCodeEnd":3457,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/spend_tracking/spend_management_endpoints.py#L3421-L3457","documentation":"Error \"Invalid limit: {limit}, error: {e}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/spend_tracking/spend_management_endpoints.py:3439 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}