{"record":{"id":"431693e5e53f7649","repo":"BerriAI/litellm","slug":"custom-llm-provider-capitalize-exception-authe","errorCode":null,"errorMessage":"{custom_llm_provider.capitalize()}Exception: Authentication Error - {error_str}","messagePattern":"(.+?)Exception: Authentication Error - (.+?)","errorType":"exception","errorClass":"AuthenticationError","httpStatus":401,"severity":"error","filePath":"litellm/litellm_core_utils/exception_mapping_utils.py","lineNumber":717,"sourceCode":"def _map_openai_like_exception(\n    *,\n    model: str,\n    original_exception: _ProviderHTTPException,\n    custom_llm_provider: str,\n    error_str: str,\n    exception_type: str,\n    exception_provider: str,\n    extra_information: str,\n) -> None:\n    if \"authorization denied for\" in error_str:\n        # Predibase returns the raw API Key in the response - this block ensures it's not returned in the exception\n        if error_str is not None and isinstance(error_str, str) and \"bearer\" in error_str.lower():\n            # only keep the first 10 chars after the occurnence of \"bearer\"\n            _bearer_token_start_index: Final = error_str.lower().find(\"bearer\")\n            error_str = error_str[: _bearer_token_start_index + 14]\n            error_str += \"XXXXXXX\" + '\"'\n\n        raise AuthenticationError(\n            message=f\"{custom_llm_provider.capitalize()}Exception: Authentication Error - {error_str}\",\n            llm_provider=custom_llm_provider,\n            model=model,\n            response=getattr(original_exception, \"response\", None),\n            litellm_debug_info=extra_information,\n        )\n    elif ExceptionCheckers.is_error_str_context_window_exceeded(error_str):\n        raise ContextWindowExceededError(\n            message=f\"{custom_llm_provider.capitalize()}Exception: Context Window Error - {error_str}\",\n            model=model,\n            llm_provider=custom_llm_provider,\n            response=getattr(original_exception, \"response\", None),\n            litellm_debug_info=extra_information,\n        )\n    elif \"token_quota_reached\" in error_str:\n        raise RateLimitError(\n            message=f\"{custom_llm_provider.capitalize()}Exception: Rate Limit Errror - {error_str}\",\n            llm_provider=custom_llm_provider,","sourceCodeStart":699,"sourceCodeEnd":735,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/litellm_core_utils/exception_mapping_utils.py#L699-L735","documentation":"Error \"{custom_llm_provider.capitalize()}Exception: Authentication Error - {error_str}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:717 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the API key/credentials for the provider."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}