{"record":{"id":"4e28009383242f27","repo":"BerriAI/litellm","slug":"exception-provider-message","errorCode":null,"errorMessage":"{exception_provider} - {message}","messagePattern":"\\{exception_provider\\} - \\{message\\}","errorType":"exception","errorClass":"NotFoundError","httpStatus":404,"severity":"error","filePath":"litellm/litellm_core_utils/exception_mapping_utils.py","lineNumber":306,"sourceCode":"    if ExceptionCheckers.is_error_str_rate_limit(\n        error_str, status_code=getattr(original_exception, \"status_code\", None)\n    ):\n        raise RateLimitError(\n            message=f\"RateLimitError: {exception_provider} - {message}\",\n            model=model,\n            llm_provider=custom_llm_provider,\n            response=getattr(original_exception, \"response\", None),\n        )\n    elif ExceptionCheckers.is_error_str_context_window_exceeded(error_str):\n        raise ContextWindowExceededError(\n            message=f\"ContextWindowExceededError: {exception_provider} - {message}\",\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 \"invalid_request_error\" in error_str and \"model_not_found\" in error_str:\n        raise NotFoundError(\n            message=f\"{exception_provider} - {message}\",\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 \"A timeout occurred\" in error_str:\n        raise Timeout(\n            message=f\"{exception_provider} - {message}\",\n            model=model,\n            llm_provider=custom_llm_provider,\n            litellm_debug_info=extra_information,\n        )\n    elif (\n        (\"invalid_request_error\" in error_str and \"content_policy_violation\" in error_str)\n        or (\"Invalid prompt\" in error_str and \"violating our usage policy\" in error_str)\n        or (\"request was rejected as a result of the safety system\" in error_str.lower())\n    ):","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/litellm_core_utils/exception_mapping_utils.py#L288-L324","documentation":"Exception-mapping branch: for provider errors that match no specific class (status 400/422-style bad requests and other generic cases), the original exception is re-raised as a litellm exception with the provider-prefixed message, preserving provider details while normalizing type.","triggerScenarios":"Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:306 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the provider message for the underlying cause and fix the request accordingly.","Enable verbose logging (litellm.set_verbose=True) to see the full provider response."],"exampleFix":null,"handlingStrategy":"try-catch","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"}