{"record":{"id":"d5d348d2476f5db0","repo":"BerriAI/litellm","slug":"failed-to-fetch-per-user-analytics-e","errorCode":null,"errorMessage":"Failed to fetch per-user analytics: {e}","messagePattern":"Failed to fetch per-user analytics: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"litellm/proxy/management_endpoints/user_agent_analytics_endpoints.py","lineNumber":798,"sourceCode":"        )\n\n        # Apply pagination\n        total_count: Final = len(results)\n        total_pages: Final = (total_count + page_size - 1) // page_size\n        start_idx: Final = (page - 1) * page_size\n        end_idx: Final = start_idx + page_size\n        paginated_results: Final = results[start_idx:end_idx]\n\n        return PerUserAnalyticsResponse(\n            results=paginated_results,\n            total_count=total_count,\n            page=page,\n            page_size=page_size,\n            total_pages=total_pages,\n        )\n\n    except Exception as e:\n        raise HTTPException(\n            status_code=500,\n            detail=f\"Failed to fetch per-user analytics: {e}\",\n        )\n","sourceCodeStart":780,"sourceCodeEnd":802,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/user_agent_analytics_endpoints.py#L780-L802","documentation":"HTTPException wrapping any unexpected exception while computing per-user analytics (aggregation or in-memory pagination over tag-spend rows). The exception text is embedded and the per-user endpoint aborts; distinct from the 400 raised for bad date inputs.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/user_agent_analytics_endpoints.py:798 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the embedded error and proxy logs; verify the database connection and query parameters, then retry."],"exampleFix":null,"handlingStrategy":"try-catch","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"}