From 4dc8f813e7d4595581c80f8af041410e5f25bf76 Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Wed, 19 Feb 2025 16:16:14 -0500 Subject: [PATCH] x --- libs/langgraph/langgraph/pregel/validate.py | 22 ++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/libs/langgraph/langgraph/pregel/validate.py b/libs/langgraph/langgraph/pregel/validate.py index cf957dc07..6b43f7b7c 100644 --- a/libs/langgraph/langgraph/pregel/validate.py +++ b/libs/langgraph/langgraph/pregel/validate.py @@ -32,11 +32,17 @@ def validate_graph( for chan in subscribed_channels: if chan not in channels: - raise ValueError(f"Subscribed channel '{chan}' not in 'channels'") + raise ValueError( + f"Subscribed channel '{chan}' not " + f"in known channels: '{repr(sorted(channels))[:100]}'" + ) if isinstance(input_channels, str): if input_channels not in channels: - raise ValueError(f"Input channel '{input_channels}' not in 'channels'") + raise ValueError( + f"Input channel '{input_channels}' not " + f"in known channels: '{repr(sorted(channels))[:100]}'" + ) if input_channels not in subscribed_channels: raise ValueError( f"Input channel {input_channels} is not subscribed to by any node" @@ -44,10 +50,13 @@ def validate_graph( else: for chan in input_channels: if chan not in channels: - raise ValueError(f"Input channel '{chan}' not in 'channels'") + raise ValueError( + f"Input channel '{chan}' not in '{repr(sorted(channels))[:100]}'" + ) if all(chan not in subscribed_channels for chan in input_channels): raise ValueError( - f"None of the input channels {input_channels} are subscribed to by any node" + f"None of the input channels {input_channels} " + f"are subscribed to by any node" ) all_output_channels = set[str]() @@ -62,7 +71,10 @@ def validate_graph( for chan in all_output_channels: if chan not in channels: - raise ValueError(f"Output channel '{chan}' not in 'channels'") + raise ValueError( + f"Output channel '{chan}' not " + f"in known channels: '{repr(sorted(channels))[:100]}'" + ) if interrupt_after_nodes != "*": for n in interrupt_after_nodes: