diff --git a/web/src/beanflows/analytics.py b/web/src/beanflows/analytics.py index 374a1a0..c054c9c 100644 --- a/web/src/beanflows/analytics.py +++ b/web/src/beanflows/analytics.py @@ -107,8 +107,12 @@ def _get_conn() -> duckdb.DuckDBPyConnection: async def fetch_analytics(sql: str, params: list | None = None) -> list[dict]: - """Run a read-only DuckDB query off the event loop. Returns list of dicts.""" - assert _db_path, "Analytics DB not configured — call open_analytics_db() first" + """Run a read-only DuckDB query off the event loop. Returns list of dicts. + Returns empty list if analytics DB is not configured (SERVING_DUCKDB_PATH unset + or file missing at startup) — dashboard routes degrade gracefully. + """ + if not _db_path: + return [] def _query(): conn = _get_conn()