Skip to content

ChatAnthropic latest version 1.3.4(langchain-anthropic) streaming fails with No generation chunks were returned #35442

@GANAPS14

Description

@GANAPS14

Checked other resources

  • 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)

from langchain_anthropic import ChatAnthropic



BASE_URL = "<organization bedrock url>"
API_KEY = "<KEY>"
MODEL = "anthropic.claude-4-5-opus-v1:0"

model = ChatAnthropic(
    model=MODEL,
    api_key=API_KEY,
    streaming=True,
    base_url=BASE_URL,
)

for chunk in model.stream("Write a short 'Hello World' poem."):
    print(chunk.content, end="|", flush=True)

Error Message and Stack Trace (if applicable)

Root cause: The Bedrock proxy sends SSE events with only data: lines (no event: field). The anthropic SDK v0.84.0 expects event: message_start, etc. Without those, sse.event is None and all events are silently skipped → 0 chunks → ValueError: No generation chunks were returned.

Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 1570, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "<location>/chatanthropicexample.py", line 20, in <module>
    for chunk in model.stream("Write a short 'Hello World' poem."):
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<location>/.venv/lib/python3.12/site-packages/langchain_core/language_models/chat_models.py", line 601, in stream
    raise err
ValueError: No generation chunks were returned

Description

model = ChatAnthropic(
model=MODEL,
api_key=API_KEY,
streaming=True,
base_url=BASE_URL,
)
is failing Version used
anthropic="^0.84.0"
langchain-anthropic = "^1.3.4"

Test : stream() fails

print("\n--- Test : model.stream() (streaming) ---")
try:
for chunk in model.stream("Say hello in one sentence."):
print(chunk.content, end="|", flush=True)
print("\n✅ stream() OK")
except Exception as e:
print(f"❌ stream() FAILED: {type(e).name}: {e}")
print("\nFull stack trace:")
traceback.print_exc()

System Info

python -m langchain_core.sys_info

System Information

OS: Darwin
OS Version: Darwin Kernel Version 24.6.0: Wed Nov 5 21:30:44 PST 2025; root:xnu-11417.140.69.705.2~1/RELEASE_ARM64_T6041
Python Version: 3.12.9 (v3.12.9:fdb81425a9a, Feb 4 2025, 12:21:36) [Clang 13.0.0 (clang-1300.0.29.30)]

Package Information

langchain_core: 1.2.15
langchain: 1.2.10
langsmith: 0.7.6
langchain_anthropic: 1.3.4
langchain_openai: 1.1.10
langchain_postgres: 0.0.16
langgraph_sdk: 0.3.9

Optional packages not installed

deepagents
deepagents-cli

Other Dependencies

anthropic: 0.84.0
asyncpg: 0.31.0
httpx: 0.28.1
jsonpatch: 1.33
langgraph: 1.0.9
numpy: 2.4.2
openai: 2.24.0
opentelemetry-api: 1.39.1
opentelemetry-exporter-otlp-proto-http: 1.39.1
opentelemetry-sdk: 1.39.1
orjson: 3.11.7
packaging: 25.0
pgvector: 0.3.6
psycopg: 3.3.3
psycopg-pool: 3.3.0
pydantic: 2.12.5
pytest: 7.4.4
pyyaml: 6.0.3
requests: 2.32.5
requests-toolbelt: 1.0.0
rich: 14.3.3
sqlalchemy: 2.0.47
tenacity: 9.1.4
tiktoken: 0.12.0
typing-extensions: 4.15.0
uuid-utils: 0.14.1
wrapt: 1.17.3
xxhash: 3.6.0
zstandard: 0.25.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    anthropic`langchain-anthropic` package issues & PRsbugRelated to a bug, vulnerability, unexpected error with an existing featureexternal

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions