BerriAI/litellm · error · ValueError

Invalid response - response.response is None - got {response

Error message

Invalid response - response.response is None - got {response}

What it means

Error signaling a malformed file-list/response payload: the OpenAIFileObject list response object lacks its expected inner 'response' content (response.response is None), so the handler cannot build the proxy response. Indicates an unexpected schema returned by the provider or a transformation bug.

Source

Thrown at litellm/proxy/openai_files_endpoints/files_endpoints.py:846

        ### RESPONSE HEADERS ###
        hidden_params: Final = getattr(response, "_hidden_params", {}) or {}
        model_id: Final = hidden_params.get("model_id", None) or ""
        cache_key: Final = hidden_params.get("cache_key", None) or ""
        api_base: Final = hidden_params.get("api_base", None) or ""

        fastapi_response.headers.update(
            ProxyBaseLLMRequestProcessing.get_custom_headers(
                user_api_key_dict=user_api_key_dict,
                model_id=model_id,
                cache_key=cache_key,
                api_base=api_base,
                version=version,
                model_region=getattr(user_api_key_dict, "allowed_model_region", ""),
            )
        )
        httpx_response: Final[httpx.Response | None] = getattr(response, "response", None)
        if httpx_response is None:
            raise ValueError(f"Invalid response - response.response is None - got {response}")

        return Response(
            content=httpx_response.content,
            status_code=httpx_response.status_code,
            headers=httpx_response.headers,
        )

    except Exception as e:
        await proxy_logging_obj.post_call_failure_hook(
            user_api_key_dict=user_api_key_dict, original_exception=e, request_data=data
        )
        verbose_proxy_logger.exception("litellm.proxy.proxy_server.retrieve_file_content(): Exception occured - %s", e)
        verbose_proxy_logger.debug(traceback.format_exc())
        if isinstance(e, HTTPException):
            raise ProxyException(
                message=getattr(e, "message", str(e.detail)),
                type=getattr(e, "type", "None"),
                param=getattr(e, "param", "None"),

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Retry the request; if it persists, check proxy logs for the malformed provider response.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/openai_files_endpoints/files_endpoints.py:846 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/6bef9a4c0b06b123. Report an issue: GitHub.