BerriAI/litellm · error · HTTPException

Failed to fetch DAU analytics: {e}

Error message

Failed to fetch DAU analytics: {e}

What it means

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.

Source

Thrown at litellm/proxy/management_endpoints/user_agent_analytics_endpoints.py:299

            dts.date,
            COUNT(DISTINCT vt.user_id) as active_users
        FROM "LiteLLM_DailyTagSpend" dts
        INNER JOIN "LiteLLM_VerificationToken" vt ON dts.api_key = vt.token
        {where_clause}
        GROUP BY dts.tag, dts.date
        ORDER BY dts.date DESC, active_users DESC
        """

        db_response: Final = _ACTIVE_USERS_ROWS.validate_python(await _query_raw(prisma_client, sql_query, *params))

        results: Final = [
            TagActiveUsersResponse(tag=row.tag, active_users=row.active_users, date=row.date) for row in db_response
        ]

        return ActiveUsersAnalyticsResponse(results=results)

    except Exception as e:
        raise HTTPException(
            status_code=500,
            detail=f"Failed to fetch DAU analytics: {e}",
        )


@router.get(
    "/tag/wau",
    response_model=ActiveUsersAnalyticsResponse,
    tags=["tag management", "user agent analytics"],
    dependencies=[Depends(user_api_key_auth)],
)
async def get_weekly_active_users(
    tag_filter: str | None = Query(
        default=None,
        description="Filter by specific tag (optional)",
    ),
    tag_filters: list[str] | None = Query(
        default=None,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Check the embedded error and proxy logs; verify the database connection and date parameters, then retry.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/user_agent_analytics_endpoints.py:299 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/13bcac70d8e003b5. Report an issue: GitHub.