BerriAI/litellm · error · HTTPException

Failed to fetch tag summary analytics: {e}

Error message

Failed to fetch tag summary analytics: {e}

What it means

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.

Source

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

                unique_users=row.unique_users or 0,
                total_requests=int(row.total_requests or 0),
                successful_requests=int(row.successful_requests or 0),
                failed_requests=int(row.failed_requests or 0),
                total_tokens=int(row.total_tokens or 0),
                total_spend=float(row.total_spend or 0.0),
            )
            for row in db_response
        ]

        return TagSummaryResponse(results=results)

    except ValueError as e:
        raise HTTPException(
            status_code=400,
            detail=f"Invalid date format. Use YYYY-MM-DD: {e}",
        )
    except Exception as e:
        raise HTTPException(
            status_code=500,
            detail=f"Failed to fetch tag summary analytics: {e}",
        )


@router.get(
    "/tag/user-agent/per-user-analytics",
    response_model=PerUserAnalyticsResponse,
    tags=["tag management", "user agent analytics"],
    dependencies=[Depends(user_api_key_auth)],
)
async def get_per_user_analytics(
    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, then retry.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/user_agent_analytics_endpoints.py:646 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/363a893307f19a0c. Report an issue: GitHub.