BerriAI/litellm · error · HTTPException
Invalid base64 content: {e}
Error message
Invalid base64 content: {e} What it means
JSON-body ingestion guard: the request supplied a file object with filename and content, but the 'content' field failed base64 decoding (malformed base64 string), so the file bytes cannot be reconstructed; rejected with 400 including the decoder's error text.
Source
Thrown at litellm/proxy/rag_endpoints/endpoints.py:348
# JSON body
data: Final = await _read_request_body(request)
ingest_options = data.get("ingest_options", {})
file_url = data.get("file_url")
file_id = data.get("file_id")
# Handle base64-encoded file in JSON body
file_obj = data.get("file")
if file_obj and isinstance(file_obj, dict):
filename: Final = file_obj.get("filename")
content_b64: Final = file_obj.get("content")
content_type = file_obj.get("content_type", "application/octet-stream")
if filename and content_b64:
try:
file_content = base64.b64decode(content_b64)
file_data = (filename, file_content, content_type)
except Exception as e:
raise HTTPException(
status_code=400,
detail={"error": f"Invalid base64 content: {e}"},
)
# Validate
if file_data is None and file_url is None and file_id is None:
raise HTTPException(
status_code=400,
detail={"error": "Must provide file, file_url, or file_id"},
)
if "vector_store" not in ingest_options:
raise HTTPException(
status_code=400,
detail={"error": "ingest_options must contain 'vector_store' configuration"},
)
# Credential fields must come from server configuration, not user requests.View on GitHub (pinned to 77b7c6c40c)
Solutions
- Send valid base64-encoded file content; re-encode the file with standard base64 and retry.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/rag_endpoints/endpoints.py:348 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/b70c035ef25126a4.
Report an issue: GitHub.