BerriAI/litellm · error · Exception

Response from PostHog API status_code: {response.status_code

Error message

Response from PostHog API status_code: {response.status_code}, text: {response.text}

What it means

Error "Response from PostHog API status_code: {response.status_code}, text: {response.text}" thrown in BerriAI/litellm.

Source

Thrown at litellm/integrations/posthog.py:102

                raise Exception("PostHog credentials not found in kwargs")
            event_payload: Final = self.create_posthog_event_payload(kwargs)

            headers: Final = {
                "Content-Type": "application/json",
            }

            payload: Final = self._create_posthog_payload([event_payload], api_key)
            capture_url: Final = f"{api_url.rstrip('/')}/batch/"

            response: Final = self.sync_client.post(
                url=capture_url,
                content=safe_dumps(payload),
                headers=headers,
            )
            response.raise_for_status()

            if response.status_code != 200:
                raise Exception(f"Response from PostHog API status_code: {response.status_code}, text: {response.text}")

            if self.is_mock_mode:
                verbose_logger.debug("[POSTHOG MOCK] Sync event successfully mocked")
            else:
                verbose_logger.debug("PostHog: Sync event successfully sent")

        except Exception as e:
            verbose_logger.exception("PostHog Sync Layer Error - %s", e)

    async def async_log_success_event(self, kwargs, response_obj, start_time, end_time):
        try:
            verbose_logger.debug("PostHog: Async logging - Enters logging function for model %s", kwargs)
            self._ensure_async_setup()  # Lazy initialization
            await self._log_async_event(kwargs, response_obj, start_time, end_time)
        except Exception as e:
            verbose_logger.exception("PostHog Layer Error - %s", e)

    async def async_log_failure_event(self, kwargs, response_obj, start_time, end_time):

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Check the PostHog API key and endpoint; see status_code and text for details.

When it happens

Trigger: Thrown at litellm/integrations/posthog.py:102 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/1a0c4ba88be5c19d. Report an issue: GitHub.