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.
class ModelAbortErrorLangChainError<this>partialOutput field includes message content that was generated prior to the abort,
such as a partial AIMessageChunk."model-abort".try {
await model.invoke(input, { signal: abortController.signal });
} catch (err) {
if (ModelAbortError.isInstance(err)) {
// Handle user cancellation, check err.partialOutput if needed
} else {
throw err;
}
}The underlying error that caused this ContextOverflowError, if any.
This property is optionally set when wrapping a lower-level error using ContextOverflowError.fromError. It allows error handlers to access or inspect the original error that led to the context overflow.
The partial message output that was produced before the operation was aborted. This is typically an AIMessageChunk, or could be undefined if no output was available.