BerriAI/litellm · error · ValueError

Unable to parse S3 URL: {https_url}

Error message

Unable to parse S3 URL: {https_url}

What it means

Error "Unable to parse S3 URL: {https_url}" thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/bedrock/files/transformation.py:1067

            key = unquote(key)
            s3_uri = f"s3://{bucket}/{key}"
        elif match2:
            # Pattern: https://bucket.s3.region.amazonaws.com/key
            bucket, region, key = match2.groups()
            key = unquote(key)
            s3_uri = f"s3://{bucket}/{key}"
        else:
            # Fallback: try to extract bucket and key from URL path
            from urllib.parse import urlparse

            parsed: Final = urlparse(https_url)
            path_parts: Final = parsed.path.lstrip("/").split("/", 1)
            if len(path_parts) >= 2:
                bucket, key = path_parts[0], path_parts[1]
                key = unquote(key)
                s3_uri = f"s3://{bucket}/{key}"
            else:
                raise ValueError(f"Unable to parse S3 URL: {https_url}")

        # Extract filename from key
        filename: Final = key.split("/")[-1] if "/" in key else key

        return s3_uri, filename

    def transform_create_file_response(
        self,
        model: str | None,
        raw_response: Response,
        logging_obj: LiteLLMLoggingObj,
        litellm_params: dict,
    ) -> OpenAIFileObject:
        """
        Transform S3 File upload response into OpenAI-style FileObject
        """
        # For S3 uploads, we typically get an ETag and other metadata
        response_headers: Final = raw_response.headers

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Pass a valid S3 HTTPS URL.

When it happens

Trigger: Thrown at litellm/llms/bedrock/files/transformation.py:1067 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/fae6818f7632da4c. Report an issue: GitHub.