LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangChain
  • Universal
  • Hub
  • Node
  • Load
  • Serializable
  • Encoder Backed
  • File System
  • In Memory
LangChain Core
  • Agents
  • Caches
  • Base
  • Dispatch
  • Web
  • Manager
  • Promises
  • Chat History
  • Context
  • Base
  • Langsmith
  • Documents
  • Embeddings
  • Errors
  • Example Selectors
  • Indexing
  • Base
  • Chat Models
  • Llms
  • Profile
  • Load
  • Serializable
  • Memory
  • Messages
  • Tool
  • Output Parsers
  • Openai Functions
  • Openai Tools
  • Outputs
  • Prompt Values
  • Prompts
  • Retrievers
  • Document Compressors
  • Runnables
  • Graph
  • Singletons
  • Stores
  • Structured Query
  • Tools
  • Base
  • Console
  • Log Stream
  • Run Collector
  • Tracer Langchain
  • Stream
  • Async Caller
  • Chunk Array
  • Context
  • Env
  • Event Source Parse
  • Format
  • Function Calling
  • Hash
  • Json Patch
  • Json Schema
  • Math
  • Ssrf
  • Stream
  • Testing
  • Tiktoken
  • Types
  • Vectorstores
Text Splitters
MCP Adapters
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangChain
UniversalHubNodeLoadSerializableEncoder BackedFile SystemIn Memory
LangChain Core
AgentsCachesBaseDispatchWebManagerPromisesChat HistoryContextBaseLangsmithDocumentsEmbeddingsErrorsExample SelectorsIndexingBaseChat ModelsLlmsProfileLoadSerializableMemoryMessagesToolOutput ParsersOpenai FunctionsOpenai ToolsOutputsPrompt ValuesPromptsRetrieversDocument CompressorsRunnablesGraphSingletonsStoresStructured QueryToolsBaseConsoleLog StreamRun CollectorTracer LangchainStreamAsync CallerChunk ArrayContextEnvEvent Source ParseFormatFunction CallingHashJson PatchJson SchemaMathSsrfStreamTestingTiktokenTypesVectorstores
Text Splitters
MCP Adapters
Language
Theme
JavaScript@langchain/coreerrors
Moduleā—Since v1.1

errors

Copy
import { ... } from "@langchain/core/errors";

Functions

deprecatedfunction
addLangChainErrorFields→ any

Classes

class
ContextOverflowError

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".

class
LangChainError

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.

class
ModelAbortError

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.

Type Aliases

typeAlias
LangChainErrorCodes: "CONTEXT_OVERFLOW" | "INVALID_PROMPT_INPUT" | "INVALID_TOOL_RESULTS" | "MESSAGE_COERCION_FAILURE" | "MODEL_AUTHENTICATION" | "MODEL_NOT_FOUND" | "MODEL_RATE_LIMIT" | "OUTPUT_PARSING_FAILURE" | "MODEL_ABORTED"

Variables

variable
ns: Namespace

The error namespace for all LangChain errors

View source on GitHub