From dfb42a5b84a68dad9704058dec5675f05aab7df7 Mon Sep 17 00:00:00 2001 From: Chester Curme Date: Mon, 9 Feb 2026 11:25:38 -0500 Subject: [PATCH] add exception to core --- libs/core/langchain_core/exceptions.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/core/langchain_core/exceptions.py b/libs/core/langchain_core/exceptions.py index 073cfa99022..f58754c9d55 100644 --- a/libs/core/langchain_core/exceptions.py +++ b/libs/core/langchain_core/exceptions.py @@ -65,6 +65,14 @@ class OutputParserException(ValueError, LangChainException): # noqa: N818 self.send_to_llm = send_to_llm +class ContextOverflowError(LangChainException): + """Exception raised when input exceeds the model's context limit. + + This exception is raised by chat models when the input tokens exceed + the maximum context window supported by the model. + """ + + class ErrorCode(Enum): """Error codes."""