alibaba/spring-ai-alibaba · error · RuntimeException

Failed to create parallel node action for target:

Error message

Failed to create parallel node action for target: 

What it means

During advanced parallel edge processing, each parallel target's node factory is invoked to produce an Action. A GraphStateException from a target node factory is rethrown as a RuntimeException naming the failing target node id.

Source

Thrown at spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/internal/ParallelEdgeProcessor.java:238

			}

			// Create a ParallelNode that executes all subgraphs in parallel
			var parallelNode = new ParallelNode(sourceNodeId, convergenceNodeId, subGraphActions, subGraphNodeIds,
					keyStrategyMap, compileConfig);

			nodeFactoriesUpdater.accept(parallelNode.id(), parallelNode.actionFactory());
			edgesUpdater.accept(sourceNodeId, new EdgeValue(parallelNode.id()));
			edgesUpdater.accept(parallelNode.id(), new EdgeValue(convergenceNodeId));
		} else {
			// Simple case: A->B->Z, A->C->Z - use ParallelNode
			var targetList = validTargets;

			var actions = targetList.stream()
					.map(target -> {
						try {
							return nodeFactories.get(target.id()).apply(compileConfig);
						} catch (GraphStateException ex) {
							throw new RuntimeException("Failed to create parallel node action for target: "
									+ target.id() + ". Cause: " + ex.getMessage(), ex);
						}
					})
					.toList();

			var actionNodeIds = targetList.stream().map(EdgeValue::id).toList();

			var parallelNode = new ParallelNode(sourceNodeId, convergenceNodeId, actions, actionNodeIds,
					keyStrategyMap, compileConfig);

			nodeFactoriesUpdater.accept(parallelNode.id(), parallelNode.actionFactory());
			edgesUpdater.accept(sourceNodeId, new EdgeValue(parallelNode.id()));
			edgesUpdater.accept(parallelNode.id(), new EdgeValue(convergenceNodeId));
		}
	}

	/**
	 * Finds the convergence node where all parallel paths from the given start nodes meet.

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Inspect the cause GraphStateException for the failing target id reported in the message.
  2. Verify the node action factory for that target validates successfully with the supplied CompileConfig.
  3. Check that the node is registered via addNode before being used as a parallel edge target.
  4. Test each parallel branch node individually to find which factory throws.

Example fix

// before: factory requires key not declared in state
var node = new AsyncNodeAction(state -> ...);
// after: declare required key in the graph state schema
KeyStrategyFactory keys = map -> { map.put("input", new AppenderChannel()); ... };
Defensive patterns

Strategy: validation

Validate before calling

// Confirm each parallel target exists and its action factory is constructible
Objects.requireNonNull(nodeFactories.get(targetId), "No factory for parallel target " + targetId);

Try / catch

try { compiled = graph.compile(config); } catch (RuntimeException e) { if (e.getMessage().startsWith("Failed to create parallel node action")) { /* fix node reported after 'for target:' */ } }

Prevention

When it happens

Trigger: nodeFactories.get(target.id()).apply(compileConfig) throws GraphStateException for one of the parallel branch targets — e.g. the node's action factory validates its inputs/edges and fails at compile time.

Common situations: Parallel fan-out to nodes whose action factories depend on state keys or edges that are missing; misdeclared node actions (async wrappers constructed incorrectly); recursionLimit/saver config mismatch in CompileConfig.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09). Data as JSON: /api/errors/6db1e0429cb7daef. Report an issue: GitHub.