{"record":{"id":"84644a2b034547f7","repo":"BerriAI/litellm","slug":"error-retrieving-usage-data-exc","errorCode":null,"errorMessage":"Error retrieving usage data: {exc}","messagePattern":"Error retrieving usage data: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/focus/database.py","lineNumber":101,"sourceCode":"            ut.user_email as user_email,\n            COALESCE(vt.organization_id, tt.organization_id) as organization_id,\n            ot.organization_alias as organization_alias\n        FROM \"LiteLLM_DailyUserSpend\" dus\n        LEFT JOIN \"LiteLLM_VerificationToken\" vt ON dus.api_key = vt.token\n        LEFT JOIN \"LiteLLM_TeamTable\" tt ON vt.team_id = tt.team_id\n        LEFT JOIN \"LiteLLM_UserTable\" ut ON dus.user_id = ut.user_id\n        LEFT JOIN \"LiteLLM_OrganizationTable\" ot\n            ON ot.organization_id = COALESCE(vt.organization_id, tt.organization_id)\n        {where_clause}\n        ORDER BY dus.date DESC, dus.created_at DESC\n        {limit_clause}\n        \"\"\"\n\n        try:\n            db_response: Final = await client.db.query_raw(query, *query_params)\n            return pl.DataFrame(db_response, infer_schema_length=None)\n        except Exception as exc:\n            raise RuntimeError(f\"Error retrieving usage data: {exc}\") from exc\n\n    async def get_table_info(self) -> dict[str, Any]:\n        \"\"\"Return metadata about the spend table for diagnostics.\"\"\"\n        client: Final = self._ensure_prisma_client()\n\n        info_query: Final = \"\"\"\n        SELECT column_name, data_type, is_nullable\n        FROM information_schema.columns\n        WHERE table_name = 'LiteLLM_DailyUserSpend'\n        ORDER BY ordinal_position;\n        \"\"\"\n        try:\n            columns_response: Final = await client.db.query_raw(info_query)\n            return {\"columns\": columns_response, \"table_name\": \"LiteLLM_DailyUserSpend\"}\n        except Exception as exc:\n            raise RuntimeError(f\"Error getting table info: {exc}\") from exc\n","sourceCodeStart":83,"sourceCodeEnd":118,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/focus/database.py#L83-L118","documentation":"Error \"Error retrieving usage data: {exc}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/integrations/focus/database.py:101 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the database connection and the daily usage table; see the wrapped exception."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}