From 5e28180d327a936fe6ffbae1d9759fee09154b31 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Thu, 18 Sep 2025 12:32:54 -0700 Subject: [PATCH] fix: BadRequestError cohere (#14691) --- litellm/litellm_core_utils/exception_mapping_utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/litellm/litellm_core_utils/exception_mapping_utils.py b/litellm/litellm_core_utils/exception_mapping_utils.py index 25ae0269ab3..6936924fe17 100644 --- a/litellm/litellm_core_utils/exception_mapping_utils.py +++ b/litellm/litellm_core_utils/exception_mapping_utils.py @@ -1449,6 +1449,14 @@ def exception_type( # type: ignore # noqa: PLR0915 model=model, response=getattr(original_exception, "response", None), ) + elif "invalid type: parameter" in error_str: + exception_mapping_worked = True + raise BadRequestError( + message=f"CohereException - {original_exception.message}", + llm_provider="cohere", + model=model, + response=getattr(original_exception, "response", None), + ) elif "too many tokens" in error_str: exception_mapping_worked = True raise ContextWindowExceededError(