LangChain.js core 1.3.7: refusals now throw ModelRefusalError instead of a parsing error (November 10, 2026)
LangChain.js now marks model refusals with a refusal block, and output parsers throw ModelRefusalError instead of a generic parse error.
Your keys
0 of 2 ready
Create each key on its own page, paste it below, then copy the finished lines into your project's .env file. What you paste stays in this tab. It is never sent to Wirestack or saved.
What changed
On November 10, 2026, LangChain.js shipped a standard way to spot a model refusal. @langchain/core 1.3.7 adds a refusal content block and a ModelRefusalError class in @langchain/core/errors. Refusals from OpenAI (Chat Completions and Responses), Anthropic (stop_reason: "refusal") and Gemini through @langchain/google now show up as a refusal block in message.contentBlocks.
This is a behavior change. The JSON, tool-call, Zod structured and standard-schema output parsers now throw ModelRefusalError when the model refuses, where before they threw a generic parsing error or returned an empty result. ModelRefusalError is non-retryable, so modelRetryMiddleware does not retry it.
langchain 1.6.4 adds modelRefusalMiddleware(), which makes an agent run throw ModelRefusalError instead of ending as if it succeeded. Middleware now passes ModelRefusalError through unwrapped, so code that checks MiddlewareError.isInstance or reads .cause will no longer see refusals there. @langchain/openai 1.8.3, @langchain/anthropic 1.6.3 and @langchain/google 0.2.14 make withStructuredOutput throw ModelRefusalError on a refusal.
