Fix root cause: model_call_details stored None for litellm_trace_id

Logging.__init__ stored the raw litellm_trace_id parameter (None when not
explicitly provided) in model_call_details, while self.litellm_trace_id
always held a valid UUID. When get_standard_logging_object_payload() failed,
both the DB and Langfuse fell back to kwargs["litellm_trace_id"] which was
None, causing each to generate different random UUIDs. Now model_call_details
stores self.litellm_trace_id (always valid), so all fallback paths use the
same ID.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Harshit28j 2026-03-02 21:15:52 +05:30
parent cac041c944
commit 2f927fef3b

View file

@ -405,7 +405,7 @@ class Logging(LiteLLMLoggingBaseClass):
self.passthrough_guardrails_config: Optional[Dict[str, Any]] = None
self.model_call_details: Dict[str, Any] = {
"litellm_trace_id": litellm_trace_id,
"litellm_trace_id": self.litellm_trace_id,
"litellm_call_id": litellm_call_id,
"input": _input,
"litellm_params": litellm_params,