{"record":{"id":"6e299d9175dbea25","repo":"BerriAI/litellm","slug":"cohereexception-error-str","errorCode":null,"errorMessage":"CohereException - {error_str}","messagePattern":"CohereException - (.+?)","errorType":"exception","errorClass":"InternalServerError","httpStatus":500,"severity":"error","filePath":"litellm/litellm_core_utils/exception_mapping_utils.py","lineNumber":1355,"sourceCode":"            model=model,\n            response=getattr(original_exception, \"response\", None),\n        )\n    elif \"invalid type: parameter\" in error_str:\n        raise BadRequestError(\n            message=f\"CohereException - {original_exception.message}\",\n            llm_provider=\"cohere\",\n            model=model,\n            response=getattr(original_exception, \"response\", None),\n        )\n    elif \"too many tokens\" in error_str:\n        raise ContextWindowExceededError(\n            message=f\"CohereException - {original_exception.message}\",\n            model=model,\n            llm_provider=\"cohere\",\n            response=getattr(original_exception, \"response\", None),\n        )\n    elif \"internal server error\" in error_str.lower():\n        raise InternalServerError(\n            message=f\"CohereException - {error_str}\",\n            model=model,\n            llm_provider=\"cohere\",\n            response=getattr(original_exception, \"response\", None),\n        )\n    elif hasattr(original_exception, \"status_code\"):\n        if original_exception.status_code == 400 or original_exception.status_code == 498:\n            raise BadRequestError(\n                message=f\"CohereException - {original_exception.message}\",\n                llm_provider=\"cohere\",\n                model=model,\n                response=getattr(original_exception, \"response\", None),\n            )\n        elif original_exception.status_code == 408:\n            raise Timeout(\n                message=f\"CohereException - {original_exception.message}\",\n                llm_provider=\"cohere\",\n                model=model,","sourceCodeStart":1337,"sourceCodeEnd":1373,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/litellm_core_utils/exception_mapping_utils.py#L1337-L1373","documentation":"Error \"CohereException - {error_str}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:1355 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the Cohere error message; adjust the request or credentials."],"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"}