BerriAI/litellm · error · ValueError
file content is required
Error message
file content is required
What it means
Content guard in the Bedrock files transformation: constructing the upload payload requires actual file content (the bytes to write to S3), and none was present on the extracted file data, so the put-object request cannot be formed.
Solutions
- Provide the file content in the upload request.
- Check the multipart form includes the file payload.
- Verify the client is not sending an empty body.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/llms/bedrock/files/transformation.py:360 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/42d11425a2583ad2.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/bedrock/files/transformation.py:360
named as: litellm-bedrock-files/{model}/{uuid}
"""
_model = openai_jsonl_content[0].get("body", {}).get("model", "")
# Remove bedrock/ prefix if present
_model = _model.removeprefix("bedrock/")
safe_model: Final = sanitize_cloud_object_component(_model.replace(":", "-"), fallback="model")
object_name: Final = f"{BEDROCK_MANAGED_S3_BATCH_PREFIX}{safe_model}-{uuid.uuid4()}.jsonl"
return object_name
def get_object_name(self, extracted_file_data: ExtractedFileData, purpose: str) -> str:
"""
Get the object name for the request
"""
extracted_file_data_content: Final = extracted_file_data.get("content")
if extracted_file_data_content is None:
raise ValueError("file content is required")
if purpose == "batch":
## 1. If jsonl, check if there's a model name
file_content: Final = self._get_content_from_openai_file(extracted_file_data_content)
# Split into lines and parse each line as JSON
openai_jsonl_content: Final = [json.loads(line) for line in file_content.splitlines() if line.strip()]
if len(openai_jsonl_content) > 0:
return self._get_s3_object_name_from_batch_jsonl(openai_jsonl_content)
## 2. If not jsonl, store under a server-generated managed object name
filename: Final = extracted_file_data.get("filename")
return build_managed_cloud_object_name(
prefix=BEDROCK_MANAGED_S3_UPLOAD_PREFIX,
filename=filename,
fallback_filename="file",
)
View on GitHub (pinned to 77b7c6c40c)