BerriAI/litellm · warning · Exception

DeepEval logging error: {e.response.text}

Error message

DeepEval logging error: {e.response.text}

What it means

DeepEval's sync HTTP helper only supports POST and surfaces provider failures by catching httpx.HTTPStatusError and re-raising a generic Exception containing the response body. Hitting it means DeepEval's platform rejected the log/trace POST with a 4xx/5xx, and the response text (JSON error from DeepEval) is embedded in the message.

Source

Thrown at litellm/integrations/deepeval/api.py:77

            "CONFIDENT_API_KEY": api_key,
        }
        # using the global non-eu variable for base url
        self.base_api_url = base_url or API_BASE_URL
        self.sync_http_handler = HTTPHandler()
        self.async_http_handler = get_async_httpx_client(llm_provider=httpxSpecialProvider.LoggingCallback)

    def _http_request(self, method: str, url: str, headers=None, json=None, params=None):
        if method != "POST":
            raise Exception("Only POST requests are supported")
        try:
            self.sync_http_handler.post(
                url=url,
                headers=headers,
                json=json,
                params=params,
            )
        except httpx.HTTPStatusError as e:
            raise Exception(f"DeepEval logging error: {e.response.text}")
        except Exception as e:
            raise e

    def send_request(self, method: HttpMethods, endpoint: Endpoints, body=None, params=None):
        url: Final = f"{self.base_api_url}{endpoint.value}"
        res: Final = self._http_request(
            method=method.value,
            url=url,
            headers=self._headers,
            json=body,
            params=params,
        )

        if res.status_code == 200:
            try:
                return res.json()
            except ValueError:
                return res.text

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Inspect the embedded response text — 401/403 means regenerate CONFIDENT_API_KEY in DeepEval's dashboard and update the env var
  2. Verify base_api_url points at the correct DeepEval region/instance
  3. If the payload schema is rejected, update litellm (or pin the last compatible version) so the DeepEval body matches the API

Example fix

# before
api = Api(api_key="stale-key")

# after
export CONFIDENT_API_KEY=<fresh key>
# then rebuild the logger
Defensive patterns

Strategy: try-catch

Validate before calling

import httpx, os

def deepeval_key_ok() -> bool:
    r = httpx.post(
        "https://app.confident-ai.com/api/v1/sdk/events",
        headers={"Authorization": f"Bearer {os.environ['CONFIDENT_API_KEY']}"},
        json={},
    )
    return r.status_code not in (401, 403)

Try / catch

try:
    api.send_request(HttpMethods.POST, Endpoints.EVENTS, body=payload)
except Exception as e:
    if "DeepEval logging error" in str(e):
        log_and_continue("DeepEval rejected payload — check key/url; not fatal for LLM traffic")
    else:
        raise

Prevention

When it happens

Trigger: DeepEvalLogger._http_request POSTs to base_api_url + endpoint and DeepEval returns an error status: 401/403 for an invalid or expired CONFIDENT_API_KEY, 404 for a wrong base URL/endpoint, 4xx for a schema-mismatched body after a litellm version change.

Common situations: CONFIDENT_API_KEY rotated or revoked; self-hosted/misconfigured base_api_url; litellm upgrade changing the DeepEval payload shape while the API endpoint tightened validation.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/f0469d07329f450b. Report an issue: GitHub.