import { ... } from "@langchain/core/errors";Read an error's retryability mark.
Mark an error as safe or unsafe to retry.
Sets a non-enumerable symbol on the error itself, leaving its class and shape untouched, so it is safe to apply to a provider SDK's own error.
Error class representing a context window overflow in a language model operation.
This error is thrown when the combined input to a language model (such as prompt tokens, historical messages, and/or instructions) exceeds the maximum context window or token limit that the model can process in a single request. Most models have defined upper limits for the number of tokens or characters allowed in a context, and exceeding this limit will prevent the operation from proceeding.
The ContextOverflowError extends the LangChainError base class with
the marker "context-overflow".
Base error class for all LangChain errors.
All LangChain error classes should extend this class (directly or
indirectly). Use LangChainError.isInstance(obj) to check if an
object is any LangChain error.
Error class representing an aborted model operation in LangChain.
This error is thrown when a model operation (such as invocation, streaming, or batching) is cancelled before it completes, commonly due to a user-initiated abort signal (e.g., via an AbortController) or an upstream cancellation event.
The ModelAbortError provides access to any partial output the model may have produced before the operation was interrupted, which can be useful for resuming work, debugging, or presenting incomplete results to users.
Error class representing a model refusal.
Providers report a refusal, such as a safety-policy refusal, as a successful response rather than an error. LangChain raises this error where a refusal cannot be treated as an answer, for example when structured output has nothing to parse, or when an agent uses refusal middleware.
The ModelRefusalError extends the LangChainError base class with
the marker "model-refusal". Retrying the same request is unlikely to succeed,
so the error is marked as not retryable.
The return type of Namespace.brand(): the original base class
intersected with a polymorphic isInstance type guard.
The error namespace for all LangChain errors