{"record":{"id":"044fde2fa1b9f0a6","repo":"HKUDS/Vibe-Trading","slug":"universe-universe-r-not-recognized-expected-one","errorCode":null,"errorMessage":"universe {universe!r} not recognized; expected one of {sorted(_UNIVERSE_TAG)}","messagePattern":"universe (.+?) not recognized; expected one of (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/src/tools/alpha_bench_tool.py","lineNumber":122,"sourceCode":"    \"\"\"Load OHLCV(+amount, +vwap) wide panel for the requested universe.\n\n    Returns a dict keyed by panel column (open/high/low/close/volume/amount/vwap)\n    where each value is a wide ``pd.DataFrame`` indexed by date (DatetimeIndex)\n    with one column per instrument.\n\n    Args:\n        universe: ``csi300`` | ``sp500`` | ``btc-usdt``.\n        period: ``YYYY-YYYY`` or ``YYYY-MM-DD/YYYY-MM-DD``.\n        use_cache: When True (default) reuse a pickle in\n            ``~/.vibe-trading/cache/`` if the same universe+period was fetched\n            before. Set to False to force a re-fetch.\n\n    Raises:\n        ValueError: unknown universe or bad period.\n        RuntimeError: ``TUSHARE_TOKEN`` unset when csi300 is requested.\n    \"\"\"\n    if universe not in _UNIVERSE_TAG:\n        raise ValueError(\n            f\"universe {universe!r} not recognized; expected one of {sorted(_UNIVERSE_TAG)}\"\n        )\n    start, end = _parse_period(period)\n\n    cache_dir = Path.home() / \".vibe-trading\" / \"cache\"\n    cache_path = cache_dir / f\"{universe}_{start}_{end}.pkl\"\n    if use_cache and cache_path.is_file():\n        cached = _read_pickle_cache(cache_path)\n        if cached is not None:\n            logger.info(\"universe %s: loaded from cache %s\", universe, cache_path)\n            return cached\n\n    if universe == \"csi300\":\n        panel = _load_csi300_panel(start, end)\n    elif universe == \"sp500\":\n        panel = _load_sp500_panel(start, end)\n    elif universe == \"btc-usdt\":\n        panel = _load_btc_panel(start, end)","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/tools/alpha_bench_tool.py#L104-L140","documentation":"_load_universe_panel looks the universe string up in the _UNIVERSE_TAG registry; unknown keys are rejected with the sorted list of valid ones (e.g. csi300, btc-usdt and friends).","triggerScenarios":"Calling run_bench/run_bench_strict/run_alpha_bench with universe='CSI300' (case mismatch), 'sp500', or a typo like 'csi-300'.","commonSituations":"LLM tool calls guessing universe names; case-sensitive mismatches; new universes not yet registered in _UNIVERSE_TAG.","solutions":["Use one of the names listed in the error message exactly (case-sensitive)","Check _UNIVERSE_TAG keys (sorted in the message) for the supported set","If a new universe is needed, register its loader and tag in the module first"],"exampleFix":"// before\nrun_alpha_bench(universe='CSI-300', period='2023')\n// after\nrun_alpha_bench(universe='csi300', period='2023')","handlingStrategy":"validation","validationCode":"from src.tools.alpha_bench_tool import _UNIVERSE_TAG\nuniverse = universe.strip().lower()\nassert universe in _UNIVERSE_TAG, f'use one of {sorted(_UNIVERSE_TAG)}'","typeGuard":"def is_known_universe(u: str) -> bool:\n    from src.tools.alpha_bench_tool import _UNIVERSE_TAG\n    return u in _UNIVERSE_TAG","tryCatchPattern":"try:\n    _load_universe_panel(universe, period)\nexcept ValueError as e:\n    if 'not recognized' in str(e):\n        show_supported_universities()","preventionTips":["Expose the valid universe list in the tool description so the LLM picks correctly","Case-normalize input before validation"],"tags":["validation","universe","alpha-bench"],"backgroundTag":"unknown-enum-value","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}