{"record":{"id":"13bcac70d8e003b5","repo":"BerriAI/litellm","slug":"failed-to-fetch-dau-analytics-e","errorCode":null,"errorMessage":"Failed to fetch DAU analytics: {e}","messagePattern":"Failed to fetch DAU analytics: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"litellm/proxy/management_endpoints/user_agent_analytics_endpoints.py","lineNumber":299,"sourceCode":"            dts.date,\n            COUNT(DISTINCT vt.user_id) as active_users\n        FROM \"LiteLLM_DailyTagSpend\" dts\n        INNER JOIN \"LiteLLM_VerificationToken\" vt ON dts.api_key = vt.token\n        {where_clause}\n        GROUP BY dts.tag, dts.date\n        ORDER BY dts.date DESC, active_users DESC\n        \"\"\"\n\n        db_response: Final = _ACTIVE_USERS_ROWS.validate_python(await _query_raw(prisma_client, sql_query, *params))\n\n        results: Final = [\n            TagActiveUsersResponse(tag=row.tag, active_users=row.active_users, date=row.date) for row in db_response\n        ]\n\n        return ActiveUsersAnalyticsResponse(results=results)\n\n    except Exception as e:\n        raise HTTPException(\n            status_code=500,\n            detail=f\"Failed to fetch DAU analytics: {e}\",\n        )\n\n\n@router.get(\n    \"/tag/wau\",\n    response_model=ActiveUsersAnalyticsResponse,\n    tags=[\"tag management\", \"user agent analytics\"],\n    dependencies=[Depends(user_api_key_auth)],\n)\nasync def get_weekly_active_users(\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":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/user_agent_analytics_endpoints.py#L281-L317","documentation":"HTTPException wrapping any unexpected exception while computing daily-active-user (DAU) analytics from the daily-tag-spend table joined to verification tokens — SQL errors, Prisma failures, or row validation mismatches. The exception text is embedded and the DAU endpoint aborts.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/user_agent_analytics_endpoints.py:299 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the embedded error and proxy logs; verify the database connection and date 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-14T00:17:10.932Z"}