{"record":{"id":"363a893307f19a0c","repo":"BerriAI/litellm","slug":"failed-to-fetch-tag-summary-analytics-e","errorCode":null,"errorMessage":"Failed to fetch tag summary analytics: {e}","messagePattern":"Failed to fetch tag summary analytics: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"litellm/proxy/management_endpoints/user_agent_analytics_endpoints.py","lineNumber":646,"sourceCode":"                unique_users=row.unique_users or 0,\n                total_requests=int(row.total_requests or 0),\n                successful_requests=int(row.successful_requests or 0),\n                failed_requests=int(row.failed_requests or 0),\n                total_tokens=int(row.total_tokens or 0),\n                total_spend=float(row.total_spend or 0.0),\n            )\n            for row in db_response\n        ]\n\n        return TagSummaryResponse(results=results)\n\n    except ValueError as e:\n        raise HTTPException(\n            status_code=400,\n            detail=f\"Invalid date format. Use YYYY-MM-DD: {e}\",\n        )\n    except Exception as e:\n        raise HTTPException(\n            status_code=500,\n            detail=f\"Failed to fetch tag summary analytics: {e}\",\n        )\n\n\n@router.get(\n    \"/tag/user-agent/per-user-analytics\",\n    response_model=PerUserAnalyticsResponse,\n    tags=[\"tag management\", \"user agent analytics\"],\n    dependencies=[Depends(user_api_key_auth)],\n)\nasync def get_per_user_analytics(\n    tag_filter: str | None = Query(\n        default=None,\n        description=\"Filter by specific tag (optional)\",\n    ),\n    tag_filters: list[str] | None = Query(\n        default=None,","sourceCodeStart":628,"sourceCodeEnd":664,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/user_agent_analytics_endpoints.py#L628-L664","documentation":"HTTPException wrapping any unexpected exception while aggregating per-tag summary metrics (unique users, request counts, tokens, spend) from the daily tag spend table. The original exception text is embedded; the tag-summary endpoint fails atomically rather than returning partial metrics.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/user_agent_analytics_endpoints.py:646 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the embedded error and proxy logs; verify the database connection, 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"}