BerriAI/litellm · error · ValueError

skip_pre_call_logic=True requires litellm_logging_obj to be

Error message

skip_pre_call_logic=True requires litellm_logging_obj to be set in data. Ensure common_processing_pre_call_logic was called before using this parameter.

What it means

Internal ValueError raised by the proxy's common request processing when a caller passes skip_pre_call_logic=True but self.data does not contain 'litellm_logging_obj'. The flag is a fast-path (used by the Responses API flows) that assumes common_processing_pre_call_logic already ran and installed a logging object in the request data; the guard makes that contract explicit instead of failing later with a NoneType error.

Source

Thrown at litellm/proxy/common_request_processing.py:1834

        user_max_tokens: int | None = None,
        user_api_base: str | None = None,
        version: str | None = None,
        is_streaming_request: bool | None = False,
        contents: list | None = None,  # Add contents parameter
        skip_pre_call_logic: bool = False,
    ) -> Any:
        """
        Common request processing logic for both chat completions and responses API endpoints
        """
        requested_model_from_client: Final[str | None] = (
            self.data.get("model") if isinstance(self.data.get("model"), str) else None
        )
        self._debug_log_request_payload()

        if skip_pre_call_logic:
            logging_obj = self.data.get("litellm_logging_obj")
            if logging_obj is None:
                raise ValueError(
                    "skip_pre_call_logic=True requires litellm_logging_obj to be set in data. "
                    "Ensure common_processing_pre_call_logic was called before using this parameter."
                )
        else:
            self.data, logging_obj = await self._pre_call_with_fallbacks(
                request=request,
                general_settings=general_settings,
                proxy_logging_obj=proxy_logging_obj,
                user_api_key_dict=user_api_key_dict,
                version=version,
                proxy_config=proxy_config,
                user_model=user_model,
                user_temperature=user_temperature,
                user_request_timeout=user_request_timeout,
                user_max_tokens=user_max_tokens,
                user_api_base=user_api_base,
                model=model,
                route_type=route_type,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Run common_processing_pre_call_logic(...) first so data['litellm_logging_obj'] is populated, then pass skip_pre_call_logic=True.
  2. Or simply do not set skip_pre_call_logic=True; the normal path builds the logging object itself.
  3. If you hold a logging object, set data['litellm_logging_obj'] explicitly before the call.
  4. On a stock install (no custom code), upgrade litellm: this indicates version skew or a patched proxy.

Example fix

// before
processing = ProxyBaseLLMRequestProcessing(data)  # data lacks litellm_logging_obj
result = await processing.common_processing(..., skip_pre_call_logic=True)

// after
await processing.common_processing_pre_call_logic(...)
result = await processing.common_processing(..., skip_pre_call_logic=True)
Defensive patterns

Strategy: validation

Validate before calling

if skip_pre_call_logic and 'litellm_logging_obj' not in data:
    raise ValueError('run common_processing_pre_call_logic before skip_pre_call_logic=True')

Try / catch

try:
    result = await processing.common_processing(..., skip_pre_call_logic=True)
except ValueError as e:
    if 'litellm_logging_obj' in str(e):
        data['litellm_logging_obj'] = logging_obj  # repair and retry once
        result = await processing.common_processing(..., skip_pre_call_logic=True)
    else:
        raise

Prevention

When it happens

Trigger: Calling the internal processing method with skip_pre_call_logic=True on a request dict that never went through common_processing_pre_call_logic (e.g. new endpoint wiring, custom forks invoking the class directly, or a code path that drops litellm_logging_obj from data).

Common situations: Contributors adding new proxy endpoints and reusing the flag without the prerequisite call; forks that copy the call pattern from responses API but skip the pre-call step; rare regressions when refactoring request pipelines.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/c126f495a7821bb5. Report an issue: GitHub.