BerriAI/litellm · error · ValueError

Got an unexpected None response from the Responses API: {res

Error message

Got an unexpected None response from the Responses API: {response}

What it means

Sanity check after the Responses API call resolves: the provider returned None instead of a ResponsesAPIResponse, which the response-id stamping and logging code cannot process; indicates a broken provider response path.

Source

Thrown at litellm/responses/main.py:549

        if asyncio.iscoroutine(init_response):
            response = await init_response
        else:
            response = init_response

        # Update the responses_api_response_id with the model_id
        if isinstance(response, ResponsesAPIResponse):
            response = ResponsesAPIRequestUtils._update_responses_api_response_id_with_model_id(
                responses_api_response=response,
                litellm_metadata=kwargs.get("litellm_metadata", {}),
                custom_llm_provider=custom_llm_provider,
            )
            # Stamp custom_llm_provider so callbacks can identify the provider
            # (mirrors litellm/main.py:1371 for chat completions)
            response._hidden_params["custom_llm_provider"] = custom_llm_provider

        if response is None:
            raise ValueError(f"Got an unexpected None response from the Responses API: {response}")

        return response
    except Exception as e:
        raise litellm.exception_type(
            model=model,
            custom_llm_provider=custom_llm_provider,
            original_exception=e,
            completion_kwargs=local_vars,
            extra_kwargs=kwargs,
        )


def _apply_prompt_management_to_responses_call(
    input: str | ResponseInputParam,
    model: str,
    custom_llm_provider: str | None,
    litellm_logging_obj: LiteLLMLoggingObj | None,
    kwargs: dict[str, Any],

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Retry the request; if persistent, check the provider response and litellm debug logs for why None was returned.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/responses/main.py:549 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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