{"record":{"id":"6312548061d23aac","repo":"HKUDS/Vibe-Trading","slug":"events-is-empty","errorCode":null,"errorMessage":"events is empty","messagePattern":"events is empty","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/src/quantlib/eventstudy.py","lineNumber":358,"sourceCode":"    Raises:\n        ValueError: If the window bounds are inconsistent, ``estimation_gap`` is\n            negative, ``model`` is unknown, the market series does not cover the\n            frame's index, or no event at all could be measured.\n    \"\"\"\n    start, end = event_window\n    if start > end:\n        raise ValueError(f\"event_window start must be <= end, got {event_window}\")\n    if estimation_gap < 0:\n        raise ValueError(f\"estimation_gap must be >= 0, got {estimation_gap}\")\n    if estimation_window < MIN_ESTIMATION_OBSERVATIONS:\n        raise ValueError(\n            f\"estimation_window must be at least {MIN_ESTIMATION_OBSERVATIONS}, \"\n            f\"got {estimation_window}\"\n        )\n    if model not in NORMAL_RETURN_MODELS:\n        raise ValueError(f\"model must be one of {NORMAL_RETURN_MODELS}, got {model!r}\")\n    if not events:\n        raise ValueError(\"events is empty\")\n\n    index = returns.index\n    missing_market = index.difference(market_returns.index)\n    if len(missing_market):\n        raise ValueError(\n            f\"market_returns is missing {len(missing_market)} label(s) present in \"\n            \"returns; align them before calling\"\n        )\n    market_aligned = market_returns.reindex(index)\n\n    relative_days = list(range(start, end + 1))\n    window_len = len(relative_days)\n\n    outcomes: list[EventOutcome] = []\n    dropped: list[tuple[str, object, str]] = []\n\n    for symbol, event_date in events:\n        if symbol not in returns.columns:","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/quantlib/eventstudy.py#L340-L376","documentation":"event_study requires a non-empty events collection; with no events there is nothing to aggregate into AAR/CAAR and statistics would be undefined, so it fails fast with a clear message.","triggerScenarios":"Passing events=[] or an empty dict/list, usually because an upstream filter (e.g. date range or universe screen) removed all events.","commonSituations":"Backtesting a period with no qualifying event dates, an events DataFrame filtered to zero rows, or a loop iteration where the last chunk is empty.","solutions":["Guard before calling: if not events: skip/log.","Widen the event date selection or fix the upstream filter that emptied the collection."],"exampleFix":"# before\nresult = event_study(returns, market, events, (0, 0))\n# after\nresult = event_study(returns, market, events, (0, 0)) if events else None","handlingStrategy":"validation","validationCode":"if not events:\n    raise SystemExit(\"no events to study\")","typeGuard":"def has_events(events) -> bool:\n    return bool(events)","tryCatchPattern":null,"preventionTips":["Filter empty event collections in the data-prep stage.","Log event counts per run to catch silent upstream filtering."],"tags":["event-study","empty-input"],"backgroundTag":"empty-collection-argument","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}