{"record":{"id":"600017e43ebe5f8f","repo":"openai/openai-python","slug":"the-bedrock-endpoint-must-be-either-mantle-or","errorCode":null,"errorMessage":"The Bedrock `endpoint` must be either `mantle` or `runtime`.","messagePattern":"The Bedrock `endpoint` must be either `mantle` or `runtime`\\.","errorType":"exception","errorClass":"OpenAIError","httpStatus":null,"severity":"error","filePath":"src/openai/providers/bedrock.py","lineNumber":399,"sourceCode":"\n\ndef bedrock(\n    *,\n    endpoint: BedrockEndpoint | None = None,\n    region: str | None = None,\n    base_url: str | httpx2.URL | None | NotGiven = NOT_GIVEN,\n    api_key: str | None | NotGiven = NOT_GIVEN,\n    token_provider: BedrockTokenProvider | None = None,\n    access_key_id: str | None = None,\n    secret_access_key: str | None = None,\n    session_token: str | None = None,\n    profile: str | None = None,\n    credential_provider: AwsCredentialsProvider | None = None,\n) -> _Provider:\n    \"\"\"Configure the standard OpenAI client for Amazon Bedrock Mantle or Runtime.\"\"\"\n\n    if endpoint is not None and endpoint not in {\"mantle\", \"runtime\"}:\n        raise OpenAIError(\"The Bedrock `endpoint` must be either `mantle` or `runtime`.\")\n\n    normalized_region = _normalize_optional_string(region)\n    if region is not None and normalized_region is None:\n        raise OpenAIError(\"The Bedrock AWS `region` must not be empty.\")\n    _validate_bedrock_region(normalized_region)\n\n    region_source: Literal[\"explicit\", \"environment\"] | None = \"explicit\" if normalized_region is not None else None\n\n    configured_base_url: httpx2.URL | None\n    if isinstance(base_url, NotGiven):\n        environment_base_url = _normalize_optional_string(os.environ.get(\"AWS_BEDROCK_BASE_URL\"))\n        configured_base_url = _normalize_base_url(environment_base_url) if environment_base_url else None\n    elif base_url is None:\n        configured_base_url = None\n    else:\n        if isinstance(base_url, str) and not base_url.strip():\n            raise OpenAIError(\"The Bedrock `base_url` must not be empty.\")\n        configured_base_url = _normalize_base_url(base_url)","sourceCodeStart":381,"sourceCodeEnd":417,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/providers/bedrock.py#L381-L417","documentation":"The `bedrock()` provider constructor only accepts the endpoint names `mantle` or `runtime` (or None for auto-detection). Any other string, including case variants like `Mantle` or full URLs, is rejected immediately with OpenAIError before any client is built.","triggerScenarios":"Calling `openai.providers.bedrock(endpoint='bedrock-runtime', ...)` or passing a hostname/URL such as 'https://bedrock-runtime.us-east-1.amazonaws.com' as endpoint; also typos or wrong casing like 'Runtime'.","commonSituations":"Developers confuse the logical endpoint name with the AWS service hostname, or copy endpoint values from AWS docs instead of the SDK's `mantle`/`runtime` enum.","solutions":["Set endpoint to exactly 'mantle' or 'runtime', or omit it to let the provider infer from base_url","Pass full hostnames via base_url instead of endpoint"],"exampleFix":"// before\nbedrock(endpoint='bedrock-runtime')\n// after\nbedrock(endpoint='runtime')","handlingStrategy":"validation","validationCode":"if endpoint is not None and endpoint not in {'mantle', 'runtime'}:\n    raise ValueError('endpoint must be mantle or runtime')","typeGuard":"from typing import Literal\n\ndef is_bedrock_endpoint(v: object) -> bool:\n    return v in ('mantle', 'runtime')","tryCatchPattern":"try:\n    bedrock(endpoint=endpoint)\nexcept OpenAIError as e:\n    if 'endpoint' in str(e):\n        # fall back to auto-detection\n        bedrock()","preventionTips":["Keep endpoint as a Literal['mantle','runtime'] typed variable","Use base_url for custom hosts, never endpoint"],"tags":["bedrock","provider","endpoint","validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"9917c6e28e66e90e1227b3d223c06a8c5441515a","analyzedAt":"2026-08-28T11:46:34.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}