From b977045679cb912e2e45567838c71f7a74160d04 Mon Sep 17 00:00:00 2001 From: vbarda Date: Wed, 20 Nov 2024 21:24:50 -0500 Subject: [PATCH] langgraph: fix error message on invalid update --- libs/langgraph/langgraph/graph/state.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/langgraph/langgraph/graph/state.py b/libs/langgraph/langgraph/graph/state.py index c581d2259..cce742911 100644 --- a/libs/langgraph/langgraph/graph/state.py +++ b/libs/langgraph/langgraph/graph/state.py @@ -627,13 +627,16 @@ class CompiledStateGraph(CompiledGraph): else: return input + # to avoid name collision below + node_key = key + def _get_state_key(input: Union[None, dict, Any], *, key: str) -> Any: if input is None: return SKIP_WRITE elif isinstance(input, dict): if all(k not in output_keys for k in input): raise InvalidUpdateError( - f"Expected node {key} to update at least one of {output_keys}, got {input}" + f"Expected node {node_key} to update at least one of {output_keys}, got {input}" ) return input.get(key, SKIP_WRITE) elif isinstance(input, Command):