[Bug]: CBEvent assigns generated uuid to self.id instead of self.id_, so events without an id all share id_=""
Author: manav8826Created Sep 28, 2026Updated Sep 28, 2026
Labelsbugtriage
Bug Description
CBEvent.__post_init__ (llama_index/core/callbacks/schema.py) is meant to generate a uuid when no id is given, but it assigns it to self.id instead of the id_ field:
if not self.id_:
self.id = str(uuid.uuid4()) # should be self.id_So every event created without an id keeps id_ == "". LlamaDebugHandler pairs events by id_, so when on_event_start() is called without an event_id, all such events collapse into a single pair.
Version
llama-index-core main (169e450)
Steps to Reproduce
from llama_index.core.callbacks import LlamaDebugHandler, CBEventType
h = LlamaDebugHandler(print_trace_on_end=False)
a = h.on_event_start(CBEventType.LLM)
b = h.on_event_start(CBEventType.LLM)
h.on_event_end(CBEventType.LLM, event_id=a)
h.on_event_end(CBEventType.LLM, event_id=b)
print(repr(a), repr(b)) # '' ''
print(len(h.get_llm_inputs_outputs())) # 1 (expected 2)
print(h.get_event_time_info(CBEventType.LLM).total_count) # 1 (expected 2)Going through CallbackManager is not affected, since it always passes an explicit id.
Relevant Logs/Tracebacks
`tests/callbacks/test_llama_debug.py::test_get_event_stats` fails consistently on Windows, because two back-to-back `datetime.now()` calls return the same value there, so `total_secs == 0.0`.
### VersionSource: run-llama/llama_index