Skip to main content

Fixed: LangGraph graph.stream() Prints Nothing and Raises No Error

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

I streamed the updates of a two-node LangGraph graph with stream_mode="update", and the loop printed nothing: no updates, no error, and an exit code of 0. The mode is called updates, with an s, and LangGraph 1.2.25 doesn't tell you when a mode's name is wrong. Spelling it right brought back one line per node.

What I Was Doing​

The graph is the one from How to See What Each Node Returns in a LangGraph Graph in Python. It has two nodes: clean tidies a name, and greet builds a greeting from it. I ran it with LangGraph 1.2.25 on Python 3.14.10, streaming each node's update with this loop at the end of main.py:

main.py (last lines)
for update in graph.stream({"name": " ada lovelace "}, stream_mode="update"):
print(update)

I ran the script, then printed its exit code, which is 0 when a program ends without an error:

Terminal
uv run main.py
echo $?

What I Expected​

Two lines, one for each node, starting with {'clean': {'name': 'Ada Lovelace'}}. Or an error, if LangGraph didn't know the mode.

What I Got​

Nothing at all from the script, and an exit code of 0:

Output
0

The terminal after uv run main.py printed nothing, followed by echo $? printing 0.

The 0 comes from the exit-code command, not from the graph. As far as the shell was concerned, the run had worked. PowerShell's $LASTEXITCODE printed 0 too.

What I Checked​

1. The names of the stream modes​

LangGraph's streaming guide has a table of the modes: values, updates, messages, custom, checkpoints, tasks and debug. There's no update. LangGraph also lists the names in a type, StreamMode, which Python can print:

Terminal
uv run python -c "from langgraph.types import StreamMode; print(StreamMode)"
Output
typing.Literal['values', 'updates', 'checkpoints', 'tasks', 'debug', 'messages', 'custom', 'tools']

The terminal after printing StreamMode: typing.Literal with values, updates, checkpoints, tasks, debug, messages, custom and tools.

updates is in the list, and update isn't. The installed version also accepts tools, which the guide's table doesn't show.

2. Whether the graph ran at all​

I added print("clean ran") as the first line of the clean node and ran the script again, still with "update". It printed clean ran, and nothing else. So the graph ran its nodes. Only the streaming was empty.

3. What LangGraph does with the name​

LangGraph's source shows why there's no error. When stream() starts, it turns the mode you pass into a set of names, without comparing it to StreamMode:

langgraph/pregel/main.py (Pregel._defaults)
if isinstance(stream_mode, str):
stream_modes = {stream_mode}

Each time the graph has something to stream, it checks that set first, and skips the item when its mode isn't there:

langgraph/pregel/_loop.py (PregelLoop._emit)
if mode not in self.stream.modes and not debug_remap:
return

The updates arrive with the mode updates. The set held only update, so every update was skipped.

Why It Happens​

stream_mode takes the mode's name as a plain string. Its type hint lists the allowed names, but Python doesn't check type hints when the code runs, and LangGraph 1.2.25 doesn't check the name either. A misspelled mode matches nothing, so the graph runs and nothing reaches the loop.

The Fix​

Spell the mode the way StreamMode lists it: updates. In main.py, change the last lines to:

main.py (last lines)
for update in graph.stream({"name": " ada lovelace "}, stream_mode="updates"):
print(update)

The fixed loop in a macOS-style code window: for update in graph.stream with the name ada lovelace and stream_mode updates, then print(update).

After the Fix​

Terminal
uv run main.py
Output
{'clean': {'name': 'Ada Lovelace'}}
{'greet': {'greeting': 'Hello, Ada Lovelace!'}}

The terminal after uv run main.py with stream_mode updates: clean with name Ada Lovelace, then greet with greeting Hello, Ada Lovelace!

One line per node, as expected: clean returned the tidied name, and greet the greeting.

Common Mistakes​

MistakeWhat happensDo this instead
stream_mode="update"Nothing streams, and the exit code is 0stream_mode="updates"
stream_mode="value"The same: nothing, exit code 0stream_mode="values"
Reading an empty stream as "the graph didn't run"The nodes did run: a print in clean still printedCheck the mode's name first

Troubleshooting​

SymptomLikely causeFix
graph.stream() prints nothing and raises no errorA mode name that StreamMode doesn't listUse one of the names StreamMode prints
A print inside a node shows, but the loop prints nothingThe same: the graph runs, but nothing is streamedThe same
mypy reports No overload variant of "stream" of "Pregel" matches argument typesA mode name that isn't in StreamMode, or an input that doesn't match the state's typeCheck the name. For the input, see Fixed: No overload variant of "stream" of "Pregel" matches argument types

FAQ​

Can a type checker catch the misspelling?​

Yes, because stream_mode's type hint is StreamMode. mypy 2.4.1 reported No overload variant of "stream" of "Pregel" matches argument types "dict[str, str]", "str" on the line with "update", and Success: no issues found in 1 source file once it said "updates". That second result needs the graph's input to match its state type too: Fixed: No overload variant of "stream" of "Pregel" matches argument types shows how.

Which modes are there?​

StreamMode printed eight in LangGraph 1.2.25: values, updates, checkpoints, tasks, debug, messages, custom and tools. The streaming guide explains each one.

Conclusion​

graph.stream(..., stream_mode="update") ran the graph and streamed nothing, with exit code 0, because LangGraph 1.2.25 keeps only the modes you name and doesn't check those names against StreamMode. Writing stream_mode="updates" brought back one line per node.

Additional Resources​

  • Streaming — the stream modes and what each one sends.
  • StreamMode — the type that lists the mode names.