{"record":{"id":"1d2baeb36a70a2a3","repo":"BerriAI/litellm","slug":"invalid-oci-region-region-r-must-match-a-z-a","errorCode":null,"errorMessage":"Invalid OCI region {region!r}: must match ^[a-z][a-z0-9-]{{0,30}}[a-z0-9]$ (e.g. 'us-ashburn-1').","messagePattern":"Invalid OCI region (.+?): must match \\^\\[a-z\\]\\[a-z0-9-\\](.+?)\\}\\[a-z0-9\\]\\$ \\(e\\.g\\. 'us-ashburn-1'\\)\\.","errorType":"exception","errorClass":"OCIError","httpStatus":400,"severity":"error","filePath":"litellm/llms/oci/common_utils.py","lineNumber":192,"sourceCode":"\n\n_OCI_REGION_RE: Final = re.compile(r\"^[a-z][a-z0-9-]{0,30}[a-z0-9]$\")\n_OCI_ACTION_PATH_RE: Final = re.compile(rf\"/{OCI_API_VERSION}/actions/[^/?#]+/?$\")\n\n\ndef get_oci_base_url(optional_params: dict, api_base: str | None = None) -> str:\n    \"\"\"Return the OCI inference base URL, respecting any explicit api_base override.\n\n    If ``api_base`` already ends with a fully-formed OCI action path\n    (``/{OCI_API_VERSION}/actions/<name>``), that suffix is stripped so callers\n    can append their own action path without producing a doubled URL.\n    \"\"\"\n    if api_base:\n        return _OCI_ACTION_PATH_RE.sub(\"\", api_base).rstrip(\"/\")\n    creds: Final = resolve_oci_credentials(optional_params)\n    region: Final = creds[\"oci_region\"]\n    if not isinstance(region, str) or not _OCI_REGION_RE.match(region):\n        raise OCIError(\n            status_code=400,\n            message=(\n                f\"Invalid OCI region {region!r}: must match ^[a-z][a-z0-9-]{{0,30}}[a-z0-9]$ (e.g. 'us-ashburn-1').\"\n            ),\n        )\n    return f\"https://inference.generativeai.{region}.oci.oraclecloud.com\"\n\n\n# ---------------------------------------------------------------------------\n# Signing implementations (shared by chat, embed, and rerank configs)\n# ---------------------------------------------------------------------------\n\n\ndef sign_with_oci_signer(\n    headers: dict,\n    optional_params: dict,\n    request_data: dict,\n    api_base: str,","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/oci/common_utils.py#L174-L210","documentation":"Error \"Invalid OCI region {region!r}: must match ^[a-z][a-z0-9-]{{0,30}}[a-z0-9]$ (e.g. 'us-ashburn-1').\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/oci/common_utils.py:192 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a valid OCI region identifier matching ^[a-z][a-z0-9-]{0,30}[a-z0-9]$, e.g. 'us-ashburn-1'."],"exampleFix":null,"handlingStrategy":null,"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"}