BerriAI/litellm · error · InternalServerError

CohereException - {error_str}

Error message

CohereException - {error_str}

What it means

Error "CohereException - {error_str}" thrown in BerriAI/litellm.

Source

Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:1355

            model=model,
            response=getattr(original_exception, "response", None),
        )
    elif "invalid type: parameter" in error_str:
        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:
        raise ContextWindowExceededError(
            message=f"CohereException - {original_exception.message}",
            model=model,
            llm_provider="cohere",
            response=getattr(original_exception, "response", None),
        )
    elif "internal server error" in error_str.lower():
        raise InternalServerError(
            message=f"CohereException - {error_str}",
            model=model,
            llm_provider="cohere",
            response=getattr(original_exception, "response", None),
        )
    elif hasattr(original_exception, "status_code"):
        if original_exception.status_code == 400 or original_exception.status_code == 498:
            raise BadRequestError(
                message=f"CohereException - {original_exception.message}",
                llm_provider="cohere",
                model=model,
                response=getattr(original_exception, "response", None),
            )
        elif original_exception.status_code == 408:
            raise Timeout(
                message=f"CohereException - {original_exception.message}",
                llm_provider="cohere",
                model=model,

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Inspect the Cohere error message; adjust the request or credentials.

When it happens

Trigger: Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:1355 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/6e299d9175dbea25. Report an issue: GitHub.