Skip to content

Commit

Permalink
Merge pull request #2496 from langchain-ai/vb/fix-error-message
Browse files Browse the repository at this point in the history
langgraph: fix error message on invalid update
  • Loading branch information
nfcampos authored Nov 21, 2024
2 parents a933776 + b977045 commit 7021e81
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libs/langgraph/langgraph/graph/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,13 +627,16 @@ def _get_root(input: Any) -> Any:
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):
Expand Down

0 comments on commit 7021e81

Please sign in to comment.