File tree 1 file changed +8
-2
lines changed
langchain-core/src/runnables
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,11 @@ export function drawMermaid(
110
110
const subgraph = prefix . split ( ":" ) . pop ( ) ! ;
111
111
112
112
if ( seenSubgraphs . has ( prefix ) ) {
113
- return ;
113
+ throw new Error (
114
+ `Found duplicate subgraph '${ subgraph } ' at '${ prefix } -- this likely means that ` +
115
+ "you're reusing a subgraph node with the same name. " +
116
+ "Please adjust your graph to have subgraph nodes with unique names."
117
+ ) ;
114
118
}
115
119
116
120
seenSubgraphs . add ( prefix ) ;
@@ -121,7 +125,9 @@ export function drawMermaid(
121
125
const nestedPrefixes = sortPrefixesByDepth (
122
126
Object . keys ( edgeGroups ) . filter (
123
127
( nestedPrefix ) =>
124
- nestedPrefix . startsWith ( `${ prefix } :` ) && nestedPrefix !== prefix
128
+ nestedPrefix . startsWith ( `${ prefix } :` ) &&
129
+ nestedPrefix !== prefix &&
130
+ nestedPrefix . split ( ":" ) . length === prefix . split ( ":" ) . length + 1
125
131
)
126
132
) ;
127
133
You can’t perform that action at this time.
0 commit comments