HKUDS/Vibe-Trading · error · RuntimeError

universe {universe!r} produced empty panel for {start}..{end

Error message

universe {universe!r} produced empty panel for {start}..{end}; check network / token / date range

What it means

After loading, the panel must contain a non-empty 'close' DataFrame. This RuntimeError means the data loader returned nothing usable — typically a network failure, invalid/expired API token, or a date range with no trading data.

Source

Thrown at agent/src/tools/alpha_bench_tool.py:145

    cache_dir = Path.home() / ".vibe-trading" / "cache"
    cache_path = cache_dir / f"{universe}_{start}_{end}.pkl"
    if use_cache and cache_path.is_file():
        cached = _read_pickle_cache(cache_path)
        if cached is not None:
            logger.info("universe %s: loaded from cache %s", universe, cache_path)
            return cached

    if universe == "csi300":
        panel = _load_csi300_panel(start, end)
    elif universe == "sp500":
        panel = _load_sp500_panel(start, end)
    elif universe == "btc-usdt":
        panel = _load_btc_panel(start, end)
    else:  # pragma: no cover — guarded above
        raise ValueError(f"unhandled universe {universe!r}")

    if not panel or "close" not in panel or panel["close"].empty:
        raise RuntimeError(
            f"universe {universe!r} produced empty panel for {start}..{end}; "
            "check network / token / date range"
        )

    # btc-usdt loader returns a single-column close (one instrument). Cross-
    # sectional IC needs >= 2 instruments — short-circuit with a clean error
    # that propagates to API (400) and CLI.
    close_df = panel["close"]
    if universe == "btc-usdt" and close_df.shape[1] < 2:
        raise ValueError(
            "btc-usdt is single-asset; cross-sectional IC needs >=2 instruments. "
            "Use a multi-symbol crypto basket (e.g. multiple OKX pairs) for "
            "meaningful results."
        )

    if use_cache:
        _write_pickle_cache(cache_dir, cache_path, panel)

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Verify network connectivity and that the data API is reachable
  2. Check/refresh the token in agent/.env (TUSHARE_TOKEN) and confirm it has the needed endpoints
  3. Widen or shift the date range to overlap actual trading history
  4. Retry after transient outages; inspect ~/.vibe-trading/cache for stale artifacts
Defensive patterns

Strategy: retry

Validate before calling

assert period covers known trading history for the universe (e.g. csi300 >= 2005)

Try / catch

try:
    panel = _load_universe_panel(u, p, use_cache=False)
except RuntimeError as e:
    if 'empty panel' in str(e):
        panel = retry_with_backoff(lambda: _load_universe_panel(u, p), attempts=3)
    else: raise

Prevention

When it happens

Trigger: Requesting csi300 or crypto data while offline; a Tushare token without permission for the window; a period entirely outside the asset's history (e.g. btc-usdt before 2010).

Common situations: CI runs without network access; expired TUSHARE_TOKEN; sandbox/proxy blocking the data API; caching disabled plus transient API outage.

Related errors


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/bbab58370b826379. Report an issue: GitHub.