{"record":{"id":"59eb24f9e593dc2a","repo":"BerriAI/litellm","slug":"invalid-aws-region-format-aws-region-name-r-re","errorCode":null,"errorMessage":"Invalid AWS region format: {aws_region_name!r}. Region names must contain only lowercase letters, digits, and hyphens.","messagePattern":"Invalid AWS region format: (.+?)\\. Region names must contain only lowercase letters, digits, and hyphens\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock/base_aws_llm.py","lineNumber":611,"sourceCode":"                    aws_region_name = configured_region\n                else:\n                    aws_region_name = \"us-west-2\"\n            except Exception:\n                aws_region_name = \"us-west-2\"\n\n        self._validate_aws_region_name(aws_region_name)\n        return aws_region_name\n\n    @staticmethod\n    def _validate_aws_region_name(aws_region_name: str | None) -> None:\n        \"\"\"\n        Validate that an AWS region name conforms to the expected format\n        (lowercase alphanumerics and hyphens). Raises ValueError otherwise.\n        \"\"\"\n        if aws_region_name is None:\n            return\n        if not isinstance(aws_region_name, str) or not _VALID_AWS_REGION_PATTERN.match(aws_region_name):\n            raise ValueError(\n                f\"Invalid AWS region format: {aws_region_name!r}. \"\n                \"Region names must contain only lowercase letters, digits, and hyphens.\"\n            )\n\n    @staticmethod\n    def _parse_sts_region_from_endpoint(\n        aws_sts_endpoint: str | None,\n    ) -> str | None:\n        \"\"\"Extract region from sts.{region}.amazonaws.com or vpce-x.sts.{region}.vpce.amazonaws.com.\"\"\"\n        if not aws_sts_endpoint:\n            return None\n        host: Final = urllib.parse.urlparse(aws_sts_endpoint).hostname or \"\"\n        match: Final = _STS_REGION_FROM_ENDPOINT_PATTERN.search(host)\n        return match.group(1) if match else None\n\n    @staticmethod\n    def _resolve_sts_region(aws_sts_endpoint: str | None = None) -> str | None:\n        \"\"\"STS signing region: parsed from aws_sts_endpoint else AWS_REGION / AWS_DEFAULT_REGION.\"\"\"","sourceCodeStart":593,"sourceCodeEnd":629,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/bedrock/base_aws_llm.py#L593-L629","documentation":"Validation failure in _validate_aws_region_name: the resolved AWS region name contains characters other than lowercase letters, digits, and hyphens. The misconfigured region (from env vars, params, or defaults) is the input at fault.","triggerScenarios":"Thrown at litellm/llms/bedrock/base_aws_llm.py:611 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a valid AWS region name (lowercase letters, digits, hyphens, e.g. us-east-1).","Check aws_region_name / AWS_REGION_NAME for typos or uppercase characters.","Remove whitespace or invalid characters from the region setting."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}