{"record":{"id":"26c27cf5fc36faf0","repo":"BerriAI/litellm","slug":"spend-tags-error-str-e","errorCode":null,"errorMessage":"\"/spend/tags Error\" + str(e)","messagePattern":"\"/spend/tags Error\" \\+ str\\(e\\)","errorType":"http","errorClass":"ProxyException","httpStatus":500,"severity":"error","filePath":"litellm/proxy/spend_tracking/spend_management_endpoints.py","lineNumber":442,"sourceCode":"        COUNT(*) AS log_count,\n        SUM(spend) AS total_spend\n        FROM \"LiteLLM_SpendLogs\"\n        GROUP BY individual_request_tag;\n        \"\"\"\n        response: Final = await get_spend_by_tags(start_date=start_date, end_date=end_date, prisma_client=prisma_client)\n\n        return response\n    except Exception as e:\n        if isinstance(e, HTTPException):\n            raise ProxyException(\n                message=getattr(e, \"detail\", f\"/spend/tags Error({e})\"),\n                type=\"internal_error\",\n                param=getattr(e, \"param\", \"None\"),\n                code=getattr(e, \"status_code\", status.HTTP_500_INTERNAL_SERVER_ERROR),\n            )\n        elif isinstance(e, ProxyException):\n            raise e\n        raise ProxyException(\n            message=\"/spend/tags Error\" + str(e),\n            type=\"internal_error\",\n            param=getattr(e, \"param\", \"None\"),\n            code=status.HTTP_500_INTERNAL_SERVER_ERROR,\n        )\n\n\nasync def get_global_activity_internal_user(\n    user_api_key_dict: UserAPIKeyAuth, start_date: datetime, end_date: datetime\n):\n    from litellm.proxy.proxy_server import prisma_client\n\n    if prisma_client is None:\n        raise HTTPException(status_code=500, detail={\"error\": \"No db connected\"})\n\n    user_id: Final = user_api_key_dict.user_id\n    if user_id is None:\n        raise HTTPException(status_code=500, detail={\"error\": \"No user_id found\"})","sourceCodeStart":424,"sourceCodeEnd":460,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/spend_tracking/spend_management_endpoints.py#L424-L460","documentation":"Error \"\"/spend/tags Error\" + str(e)\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/spend_tracking/spend_management_endpoints.py:442 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the appended error and logs; verify date filters and DB connectivity, then retry /spend/tags."],"exampleFix":null,"handlingStrategy":null,"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"}