BerriAI/litellm · error · ValueError

Invalid aws_region_name format

Error message

Invalid aws_region_name format

What it means

Format guard in the S3 Vectors config: aws_region_name was supplied but does not match the expected AWS region format, so embedding it into the endpoint URL would produce an invalid address; validation fails before the request is built.

Source

Thrown at litellm/llms/s3_vectors/vector_stores/transformation.py:65

        optional_params: dict,
        drop_params: bool,
    ) -> dict:
        for param, value in non_default_params.items():
            if param == "max_num_results":
                optional_params["maxResults"] = value
        return optional_params

    def validate_environment(self, headers: dict, litellm_params: GenericLiteLLMParams | None) -> dict:
        headers = headers or {}
        headers.setdefault("Content-Type", "application/json")
        return headers

    def get_complete_url(self, api_base: str | None, litellm_params: dict) -> str:
        aws_region_name: Final = litellm_params.get("aws_region_name")
        if not aws_region_name:
            raise ValueError("aws_region_name is required for S3 Vectors")
        if not re.match(r"^[a-z][a-z0-9-]*$", aws_region_name):
            raise ValueError("Invalid aws_region_name format")
        return f"https://s3vectors.{aws_region_name}.api.aws"

    def transform_search_vector_store_request(
        self,
        vector_store_id: str,
        query: str | list[str],
        vector_store_search_optional_params: VectorStoreSearchOptionalRequestParams,
        api_base: str,
        litellm_logging_obj: LiteLLMLoggingObj,
        litellm_params: dict,
        extra_body: dict[str, Any] | None = None,
    ) -> tuple[str, dict]:
        """Sync version - generates embedding synchronously."""
        # For S3 Vectors, vector_store_id should be in format: bucket_name:index_name
        # If not in that format, try to construct it from litellm_params
        bucket_name: str
        index_name: str

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Provide a valid AWS region like 'us-east-1' or 'eu-west-1'.
  2. Check for typos in aws_region_name.

Example fix

aws_region_name="us-east-1"
Defensive patterns

Strategy: validation

When it happens

Trigger: Triggered when the aws_region_name provided for S3 Vectors does not match a valid AWS region format.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/d98909b77961638e. Report an issue: GitHub.