{"record":{"id":"2a2efe5f5fe5e034","repo":"BerriAI/litellm","slug":"limit-must-be-greater-than-0","errorCode":null,"errorMessage":"Limit must be greater than 0","messagePattern":"Limit must be greater than 0","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/spend_tracking/spend_management_endpoints.py","lineNumber":3435,"sourceCode":"    response: Sequence[Mapping[str, object]]\n    if (\n        user_api_key_dict.user_role == LitellmUserRoles.INTERNAL_USER\n        or user_api_key_dict.user_role == LitellmUserRoles.INTERNAL_USER_VIEW_ONLY\n    ):\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","sourceCodeStart":3417,"sourceCodeEnd":3453,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/spend_tracking/spend_management_endpoints.py#L3417-L3453","documentation":"Error \"Limit must be greater than 0\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/spend_tracking/spend_management_endpoints.py:3435 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a positive integer for the limit query parameter (e.g., limit=100).","Remove the limit parameter to use the default page size."],"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-14T05:17:10.506Z"}