BerriAI/litellm · error · ValueError
Reducto /upload returned a non-JSON 200 response: {response.
Error message
Reducto /upload returned a non-JSON 200 response: {response.text} What it means
Response-shape guard after a Reducto /upload call: the HTTP status was 200 but response.json() raised, meaning the body is not JSON (unexpected gateway/content response), and the raw text is surfaced for diagnosis.
Source
Thrown at litellm/llms/reducto/common.py:69
_raise_bad_request("Invalid Reducto data URI provided.", model=model)
if ";base64" not in header:
_raise_bad_request("Reducto only supports base64-encoded data URIs.", model=model)
mime: Final = header.removeprefix("data:").split(";")[0] or "application/octet-stream"
try:
raw_bytes: Final = base64.b64decode(encoded, validate=True)
except (binascii.Error, ValueError):
_raise_bad_request("Invalid Reducto base64 payload provided.", model=model)
return None, raw_bytes, mime
def _extract_file_id_from_upload_response(response: Any) -> str:
try:
payload: Final = response.json()
except ValueError as exc:
raise ValueError(f"Reducto /upload returned a non-JSON 200 response: {response.text}") from exc
file_id: Final = (payload or {}).get("file_id") if isinstance(payload, dict) else None
if not isinstance(file_id, str) or not file_id:
raise ValueError(f"Reducto /upload returned 200 without a file_id; got payload={payload}")
return file_id
def upload_bytes_sync(
raw_bytes: bytes,
mime: str | None,
api_key: str,
api_base: str | None,
) -> str:
import litellm
response: Final = litellm.module_level_client.post(
url="{}{}".format(_normalize_api_base(api_base), "/upload"),
headers={"Authorization": f"Bearer {api_key}"},
files={"file": ("document", raw_bytes, mime or "application/octet-stream")},View on GitHub (pinned to 77b7c6c40c)
Solutions
- The Reducto /upload endpoint returned non-JSON content; check api_base and proxy configuration.
- Verify the Reducto server version and that the upload endpoint is correct.
Example fix
# curl the /upload endpoint manually and inspect the raw body.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Triggered when the Reducto /upload endpoint returns HTTP 200 with a body that is not valid JSON.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/41ec2222c3b7822d.
Report an issue: GitHub.