Fixed: No overload variant of "stream" of "Pregel" matches argument types
I checked a small LangGraph graph with mypy, and it stopped at the line that streams the graph: No overload variant of "stream" of "Pregel" matches argument types "dict[str, str]", "str". The program itself ran fine. The input left out the greeting key, which the graph's State type requires, so mypy couldn't accept it as a State. Marking greeting as NotRequired fixed it.
What I Was Doing
The graph is the one from How to See What Each Node Returns in a LangGraph Graph in Python, with LangGraph 1.2.25 on Python 3.14.10. Its state has two keys, and the input fills in only the first one, because the greet node adds the greeting later:
class State(TypedDict):
name: str
greeting: str
...
for update in graph.stream({"name": " ada lovelace "}, stream_mode="updates"):
print(update)
The script ran and printed both nodes' updates. Then I checked it with mypy 2.4.1, a type checker, which reads the type hints and reports mismatches without running the code:
uv run --with mypy mypy main.py
uv run runs mypy inside the project's environment, where it can read LangGraph's own type hints. --with mypy adds mypy for this one command. uv's command reference says that such packages are "layered on top of the project environment in a separate, ephemeral environment", so pyproject.toml stays as it is.
What I Expected
No errors. The script worked, and its types looked right.
What I Got
One error, on line 27, the line with graph.stream(...):
main.py:27: error: No overload variant of "stream" of "Pregel" matches argument types "dict[str, str]", "str" [call-overload]
main.py:27: note: Possible overload variants:
main.py:27: note: def stream(self, input: State | Command[Any] | None, config: RunnableConfig | None = ..., *, context: None = ..., stream_mode: Literal['values', 'updates', 'checkpoints', 'tasks', 'debug', 'messages', 'custom', 'tools'] | ...
main.py:27: note: def stream(self, input: State | Command[Any] | None, config: RunnableConfig | None = ..., *, context: None = ..., stream_mode: Literal['values', 'updates', 'checkpoints', 'tasks', 'debug', 'messages', 'custom', 'tools'] | ...
Found 1 error in 1 file (checked 1 source file)
![The terminal after uv run --with mypy mypy main.py: main.py line 27, error No overload variant of stream of Pregel matches argument types dict[str, str] and str, call-overload, two long notes listing the stream signatures with input State | Command[Any] | None, and Found 1 error in 1 file.](https://strdewiridedevblogsprod.blob.core.windows.net/images/blog/ai/langgraph/fixes/2026/langgraph-mypy-overload-01-error.webp)
What I Checked
1. What call-overload means
mypy's list of error codes explains it: "When you call an overloaded function, mypy checks that at least one of the signatures of the overload items match the argument types in the call." stream() has two such signatures, the two notes, and both want input: State | Command[Any] | None. mypy saw the input as a dict[str, str] instead.
2. The input on its own
To see why the input wasn't a State, I checked a file with just the type and the input:
from typing import TypedDict
class State(TypedDict):
name: str
greeting: str
start: State = {"name": " ada lovelace "}
uv run --with mypy mypy check_input.py
check_input.py:9: error: Missing key "greeting" for TypedDict "State" [typeddict-item]
Found 1 error in 1 file (checked 1 source file)
There it was: without a greeting, the dictionary isn't a State.
3. What the typing docs say about keys
The typing documentation says: "By default, all keys must be present in a TypedDict. It is possible to mark individual keys as non-required using NotRequired". State marks none, so both keys are required.
4. What LangGraph's docs do
LangGraph's time-travel guide marks the keys its nodes fill in later as NotRequired, as in topic: NotRequired[str]. Its state guide offers a second way, a separate input schema, and says: "The input schema validates the provided input."
Why It Happens
stream() takes the graph's input type, which is the state type unless you give the graph another one. State says that a state always has both a name and a greeting. The input has only a name, because the greet node adds the greeting during the run, so by the type's rules it isn't a State, and neither signature of stream() accepts it. Python doesn't check type hints when it runs the code, which is why the script worked anyway.
The Fix
Mark the key that a node fills in as NotRequired. In main.py, change the first line and the State:
from typing import NotRequired, TypedDict
from langgraph.graph import END, START, StateGraph
class State(TypedDict):
name: str
greeting: NotRequired[str]

NotRequired comes from the same typing module as TypedDict. The typing documentation lists it as "Added in version 3.11". name stays required, so mypy still reports an input that leaves out the name.
Or Give the Graph an Input Schema
Instead of changing State, you can describe the input separately. Add an InputState above State, and pass it to StateGraph:
class InputState(TypedDict):
name: str
class State(TypedDict):
name: str
greeting: str
...
builder = StateGraph(State, input_schema=InputState)
The input now has to match InputState, which asks only for a name. mypy printed Success: no issues found in 1 source file for this version too, and the graph printed the same two updates.
After the Fix
uv run --with mypy mypy main.py
Success: no issues found in 1 source file

The graph still runs as before. uv run main.py printed:
{'clean': {'name': 'Ada Lovelace'}}
{'greet': {'greeting': 'Hello, Ada Lovelace!'}}
The Same Error from invoke()
invoke() gets the same check. In a copy of the graph that ended with print(graph.invoke({"name": " ada lovelace "})) instead of the loop, mypy reported:
invoke_check.py:27: error: No overload variant of "invoke" of "Pregel" matches argument type "dict[str, str]" [call-overload]
The same fix, greeting: NotRequired[str], turned it into Success: no issues found in 1 source file.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
Running uvx mypy main.py | mypy runs on its own, without the project's packages: Cannot find implementation or library stub for module named "langgraph.graph" [import-not-found] | Run uv run --with mypy mypy main.py from the project folder |
Reading the error as a problem with stream_mode | The message lists "str" for the mode, but the mode was fine: the input caused it | Check the input against the state type, as check_input.py does |
| Taking a working run as proof that the types fit | The script ran, and mypy still found a mismatch, because Python doesn't check type hints when it runs | Run mypy, or the type checker in your editor, on the file |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
No overload variant of "stream" of "Pregel" matches argument types "dict[str, str]", ... | The input leaves out a key that the state type requires | NotRequired on the keys that nodes fill in, or an input_schema |
No overload variant of "invoke" of "Pregel" matches argument type "dict[str, str]" | The same, from invoke() | The same |
Missing key "greeting" for TypedDict "State" | A dictionary declared as State without every required key | Add the key, or mark it NotRequired |
Cannot find implementation or library stub for module named "langgraph.graph" | mypy runs outside the project's environment | uv run --with mypy mypy main.py |
FAQ
Does NotRequired change how the graph runs?
No. Python doesn't check type hints at run time, and the graph printed the same two updates before and after the change. The change only tells type checkers that a state can exist without a greeting.
Which fix should I use?
Both made mypy pass. NotRequired is the smaller change. An input schema says exactly what a caller must pass, and LangGraph's state guide adds that it "validates the provided input".
Can mypy also catch a misspelled stream mode?
Yes, once the input fits. With the fix in place, stream_mode="update" gave the same No overload variant of "stream" error, and stream_mode="updates" passed. Fixed: LangGraph graph.stream() Prints Nothing and Raises No Error shows what that misspelling does at run time.
Conclusion
mypy rejected graph.stream({"name": ...}) because the input left out greeting, a key that State required, so it wasn't a State. Marking greeting as NotRequired, or giving the graph an input_schema with only a name, made mypy print Success: no issues found in 1 source file, and the graph ran exactly as before.
Additional Resources
- Check calls to overloaded functions — mypy's
call-overloaderror code. - typing.TypedDict — required keys and
NotRequired. - Define input and output schemas — LangGraph's
input_schema. - uv run —
--withand the other options.
