langchain - ✅(Solved) Fix docs(core): retired `claude-2` model referenced in `RunnableWithMessageHistory` docstring examples [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langchain-ai/langchain#37173Fetched 2026-05-05 05:43:46
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Author
Participants
Timeline (top)
labeled ×3commented ×1cross-referenced ×1issue_type_added ×1

The two illustrative examples in the RunnableWithMessageHistory class docstring (in langchain_core.runnables.history) build a chain with ChatAnthropic(model="claude-2"). Anthropic retired the claude-2 model family in 2025, so users copy-pasting the docstring example hit a not-found error from the Anthropic API.

Expected: the docstring example uses a currently-GA Anthropic model, so copy-pasting it works. Actual: the example references a retired model.

Proposed fix: replace both occurrences with claude-sonnet-4-6, matching the convention already used in langchain_core.runnables.fallbacks (see the with_fallbacks example). Documentation-only change; no public API or runtime behavior is affected.

I have a one-file diff ready locally and would like to be assigned this issue so I can open the PR.

Error Message

anthropic.NotFoundError: Error code: 404 — {"type":"error","error":{"type":"not_found_error","message":"model: claude-2"}}

Root Cause

The two illustrative examples in the RunnableWithMessageHistory class docstring (in langchain_core.runnables.history) build a chain with ChatAnthropic(model="claude-2"). Anthropic retired the claude-2 model family in 2025, so users copy-pasting the docstring example hit a not-found error from the Anthropic API.

Expected: the docstring example uses a currently-GA Anthropic model, so copy-pasting it works. Actual: the example references a retired model.

Proposed fix: replace both occurrences with claude-sonnet-4-6, matching the convention already used in langchain_core.runnables.fallbacks (see the with_fallbacks example). Documentation-only change; no public API or runtime behavior is affected.

I have a one-file diff ready locally and would like to be assigned this issue so I can open the PR.

Fix Action

Fix / Workaround

  • This is a bug, not a usage question.
  • I added a clear and descriptive title that summarizes this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
  • This is not related to the langchain-community package.
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

PR fix notes

PR #37181: fix(core): update retired claude-2 model in RunnableWithMessageHistory docstrings

Description (problem / solution / changelog)

Summary

Updates the references in docstrings to , since Anthropic retired the model family.

Changes

  • lines 138 and 191: replace with

Motivation

Anyone copy-pasting the current docstring examples gets a 404 error from the Anthropic API:

anthropic.NotFoundError: Error code: 404 - {"type":"error","error":{"type":"not_found_error","message":"model: claude-2"}}

Fixes #37173

Changed files

  • libs/core/langchain_core/runnables/history.py (modified, +2/-2)

Code Example

# The two docstring examples on `RunnableWithMessageHistory` in
# `langchain_core.runnables.history` (lines 138 and 191 of `history.py`)
# instantiate the chat model as:
from langchain_anthropic import ChatAnthropic

ChatAnthropic(model="claude-2")
# Anthropic retired the `claude-2` model family in 2025, so anyone
# copy-pasting these examples gets a model-not-found error from the API.

---

anthropic.NotFoundError: Error code: 404{"type":"error","error":{"type":"not_found_error","message":"model: claude-2"}}
RAW_BUFFERClick to expand / collapse

Submission checklist

  • This is a bug, not a usage question.
  • I added a clear and descriptive title that summarizes this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
  • This is not related to the langchain-community package.
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Package (Required)

  • langchain
  • langchain-openai
  • langchain-anthropic
  • langchain-classic
  • langchain-core
  • langchain-model-profiles
  • langchain-tests
  • langchain-text-splitters
  • langchain-chroma
  • langchain-deepseek
  • langchain-exa
  • langchain-fireworks
  • langchain-groq
  • langchain-huggingface
  • langchain-mistralai
  • langchain-nomic
  • langchain-ollama
  • langchain-openrouter
  • langchain-perplexity
  • langchain-qdrant
  • langchain-xai
  • Other / not sure / general

Related Issues / PRs

No response

Reproduction Steps / Example Code (Python)

# The two docstring examples on `RunnableWithMessageHistory` in
# `langchain_core.runnables.history` (lines 138 and 191 of `history.py`)
# instantiate the chat model as:
from langchain_anthropic import ChatAnthropic

ChatAnthropic(model="claude-2")
# Anthropic retired the `claude-2` model family in 2025, so anyone
# copy-pasting these examples gets a model-not-found error from the API.

Error Message and Stack Trace (if applicable)

anthropic.NotFoundError: Error code: 404{"type":"error","error":{"type":"not_found_error","message":"model: claude-2"}}

Description

The two illustrative examples in the RunnableWithMessageHistory class docstring (in langchain_core.runnables.history) build a chain with ChatAnthropic(model="claude-2"). Anthropic retired the claude-2 model family in 2025, so users copy-pasting the docstring example hit a not-found error from the Anthropic API.

Expected: the docstring example uses a currently-GA Anthropic model, so copy-pasting it works. Actual: the example references a retired model.

Proposed fix: replace both occurrences with claude-sonnet-4-6, matching the convention already used in langchain_core.runnables.fallbacks (see the with_fallbacks example). Documentation-only change; no public API or runtime behavior is affected.

I have a one-file diff ready locally and would like to be assigned this issue so I can open the PR.

System Info

System Information

OS: Linux OS Version: #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025 Python Version: 3.12.3 (main, Mar 23 2026, 19:04:32) [GCC 13.3.0]

Package Information

langchain_core: 1.3.2 langsmith: 0.7.31 langchain_protocol: 0.0.10 langchain_tests: 1.1.7 langchain_text_splitters: 1.1.2

extent analysis

TL;DR

Update the RunnableWithMessageHistory class docstring examples in langchain_core.runnables.history to use a currently available Anthropic model, such as claude-sonnet-4-6.

Guidance

  • Identify the occurrences of ChatAnthropic(model="claude-2") in the docstring examples and replace them with ChatAnthropic(model="claude-sonnet-4-6").
  • Verify that the updated examples work as expected by running them without encountering a NotFoundError from the Anthropic API.
  • Consider updating any other references to retired models in the documentation to ensure consistency and accuracy.
  • Before making the changes, ensure you have the latest version of the langchain_core package to avoid any potential conflicts.

Example

from langchain_anthropic import ChatAnthropic

# Updated example
ChatAnthropic(model="claude-sonnet-4-6")

Notes

The proposed fix is a documentation-only change and does not affect the public API or runtime behavior of the langchain_core package.

Recommendation

Apply the workaround by updating the docstring examples to use a currently available Anthropic model, such as claude-sonnet-4-6, to ensure that users can successfully run the examples without encountering errors.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

langchain - ✅(Solved) Fix docs(core): retired `claude-2` model referenced in `RunnableWithMessageHistory` docstring examples [1 pull requests, 1 comments, 2 participants]