BerriAI/litellm · error · ValueError
Invalid S3 URI format
Error message
Invalid S3 URI format: {s3_uri} What it means
URI-parsing guard in parse_s3_uri: the supplied string does not start with 's3://', so it cannot be split into bucket and key components. The s3_uri argument (used for batch input/output locations) is the invalid input.
Solutions
- Use a valid S3 URI of the form s3://bucket/key.
- Check the s3_uri for missing 's3://' prefix or typos.
- URL-encode special characters in the key if needed.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/llms/bedrock/common_utils.py:1409 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/5e6c63a49f7edb8d.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/bedrock/common_utils.py:1409
if model.startswith("bedrock/"):
return model[8:] # Remove "bedrock/" prefix
return model
def parse_s3_uri(self, s3_uri: str) -> tuple:
"""
Parse S3 URI into bucket and key components.
Args:
s3_uri: S3 URI (e.g., "s3://bucket/key/path")
Returns:
Tuple of (bucket, key)
Raises:
ValueError: If URI format is invalid
"""
if not s3_uri.startswith("s3://"):
raise ValueError(f"Invalid S3 URI format: {s3_uri}")
s3_parts: Final = s3_uri[5:].split("/", 1) # Remove "s3://" and split on first "/"
if len(s3_parts) != 2:
raise ValueError(f"Invalid S3 URI format: {s3_uri}")
return s3_parts[0], s3_parts[1] # bucket, key
def extract_model_from_s3_file_path(self, s3_uri: str, optional_params: dict) -> str:
"""
Extract model ID from S3 file path.
The Bedrock file transformation creates S3 objects with the model name embedded:
Format: s3://bucket/litellm-bedrock-files-{model}-{uuid}.jsonl
"""
# Check if model is provided in optional_params first
if "model" in optional_params and optional_params["model"]:
return self.get_bedrock_model_id_from_litellm_model(optional_params["model"])
View on GitHub (pinned to 77b7c6c40c)