BerriAI/litellm · error · ValueError
standard_logging_object not found in kwargs
Error message
standard_logging_object not found in kwargs
What it means
Error "standard_logging_object not found in kwargs" thrown in BerriAI/litellm.
Source
Thrown at litellm/integrations/posthog.py:152
self.log_queue.append({"event": event_payload, "api_key": api_key, "api_url": api_url})
verbose_logger.debug("PostHog, event added to queue. Will flush in %s seconds...", self.flush_interval)
if len(self.log_queue) >= self.batch_size:
await self.flush_queue()
def create_posthog_event_payload(self, kwargs: dict[str, Any]) -> PostHogEventPayload:
"""
Helper function to create a PostHog event payload for logging
Args:
kwargs (Dict[str, Any]): request kwargs containing standard_logging_object
Returns:
PostHogEventPayload: defined in types.py
"""
standard_logging_object: Final[StandardLoggingPayload | None] = kwargs.get("standard_logging_object", None)
if standard_logging_object is None:
raise ValueError("standard_logging_object not found in kwargs")
call_type: Final = standard_logging_object.get("call_type", "")
event_name: Final = "$ai_embedding" if call_type == "embedding" else "$ai_generation"
properties: Final = self._create_posthog_properties(
standard_logging_object=standard_logging_object,
kwargs=kwargs,
event_name=event_name,
)
distinct_id: Final = self._get_distinct_id(standard_logging_object, kwargs)
return PostHogEventPayload(
event=event_name,
properties=properties,
distinct_id=distinct_id,
)
View on GitHub (pinned to 6c2dcb801b)
Solutions
- Ensure standard_logging_object is present in kwargs before the PostHog callback runs.
When it happens
Trigger: Thrown at litellm/integrations/posthog.py:152 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/b4e550199ccc551f.
Report an issue: GitHub.