Submission checklist
Package (Required)
Related Issues / PRs
No response
Reproduction Steps / Example Code (Python)
from langchain_core.runnables.utils import AddableDict
a = AddableDict({"count": 1})
b = AddableDict({"count": "some_string"})
result = a + b
print(result)
Error Message and Stack Trace (if applicable)
No error is raised. This is the bug — the operation should either succeed correctly or raise a clear error, but instead it silently produces incorrect output with no indication anything went wrong.
Description
I'm using AddableDict (langchain_core.runnables.utils), which is used internally
in RunnablePassthrough and LCEL's streaming/chunk-aggregation path.
I expect merging two AddableDict instances with a type-incompatible value at the
same key to either merge correctly or raise a clear error.
Instead, add and radd catch TypeError internally and silently fall back
to the right-hand value, discarding the left-hand value with no warning:
try:
added = chunk[key] + other[key]
except TypeError:
added = other[key]
chunk[key] = added
In the reproduction above, the int 1 is silently lost and replaced by the string,
with no exception or log. Since AddableDict is used in real chain output
aggregation, this could cause silent data loss whenever streamed/merged chunks
have mismatched types at the same key — a caller has no way to know data was dropped.
Suggested fix: raise a clear error instead of silently discarding data, e.g.:
except TypeError as e:
raise TypeError(
f"Cannot add incompatible types for key '{key}': "
f"{type(chunk[key])} and {type(other[key])}"
) from e
System Info
System Information
OS: Linux
OS Version: #1 SMP PREEMPT_DYNAMIC Dmitri Iouchtchenko (@0)
Python Version: 3.12.3 (main, Mar 3 2026, 12:15:18) [GCC 13.3.0]
Package Information
langchain_core: 1.4.9
langsmith: 0.10.3
langchain_protocol: 0.0.18
Other Dependencies
anyio: 4.14.2
distro: 1.9.0
httpx: 0.28.1
jsonpatch: 1.33
orjson: 3.11.9
packaging: 26.0
pydantic: 2.13.4
pyyaml: 6.0.3
requests: 2.33.1
requests-toolbelt: 1.0.0
sniffio: 1.3.1
tenacity: 9.1.4
typing-extensions: 4.15.0
uuid-utils: 0.17.0
websockets: 16.1
wrapt: 2.1.2
xxhash: 3.8.1
zstandard: 0.25.0
Submission checklist
Package (Required)
Related Issues / PRs
No response
Reproduction Steps / Example Code (Python)
Error Message and Stack Trace (if applicable)
Description
I'm using AddableDict (langchain_core.runnables.utils), which is used internally
in RunnablePassthrough and LCEL's streaming/chunk-aggregation path.
I expect merging two AddableDict instances with a type-incompatible value at the
same key to either merge correctly or raise a clear error.
Instead, add and radd catch TypeError internally and silently fall back
to the right-hand value, discarding the left-hand value with no warning:
In the reproduction above, the int 1 is silently lost and replaced by the string,
with no exception or log. Since AddableDict is used in real chain output
aggregation, this could cause silent data loss whenever streamed/merged chunks
have mismatched types at the same key — a caller has no way to know data was dropped.
Suggested fix: raise a clear error instead of silently discarding data, e.g.:
System Info
System Information
Package Information
Other Dependencies