{"record":{"id":"8e2c2d32565c536b","repo":"BerriAI/litellm","slug":"error-str","errorCode":null,"errorMessage":"{error_str}","messagePattern":"\\{error_str\\}","errorType":"exception","errorClass":"ContextWindowExceededError","httpStatus":400,"severity":"error","filePath":"litellm/litellm_core_utils/exception_mapping_utils.py","lineNumber":1428,"sourceCode":"                llm_provider=\"cohere\",\n                model=model,\n                request=getattr(original_exception, \"request\", None),\n            )\n        raise cast(Exception, original_exception)\n\n\ndef _map_huggingface_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 \"length limit exceeded\" in error_str:\n        raise ContextWindowExceededError(\n            message=error_str,\n            model=model,\n            llm_provider=\"huggingface\",\n            response=getattr(original_exception, \"response\", None),\n        )\n    elif \"A valid user token is required\" in error_str:\n        raise BadRequestError(\n            message=error_str,\n            llm_provider=\"huggingface\",\n            model=model,\n            response=getattr(original_exception, \"response\", None),\n        )\n    elif \"Rate limit reached\" in error_str:\n        raise RateLimitError(\n            message=error_str,\n            llm_provider=\"huggingface\",\n            model=model,\n            response=getattr(original_exception, \"response\", None),","sourceCodeStart":1410,"sourceCodeEnd":1446,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/litellm_core_utils/exception_mapping_utils.py#L1410-L1446","documentation":"Error \"{error_str}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:1428 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the error string from the provider and adjust the request."],"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-15T17:31:12.345Z"}