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
When compiling parallel (fan-out) edges, CompiledGraph instantiates the AsyncNodeActionWithConfig for each parallel target. If a node factory throws GraphStateException, it is rethrown as a RuntimeException ('Failed to create parallel node action for target: <id>') with the original cause.
Source
Thrown at spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/CompiledGraph.java:235
var conditionalEdges = parallelNodeEdges.stream()
.filter(ee -> ee.target().value() != null)
.toList();
if (!conditionalEdges.isEmpty()) {
throw Errors.unsupportedConditionalEdgeOnParallelNode.exception(e.sourceId(),
conditionalEdges.stream().map(Edge::sourceId).toList());
}
throw Errors.illegalMultipleTargetsOnParallelNode.exception(e.sourceId(), parallelNodeTargets);
}
var targetList = parallelNodeStream.get().toList();
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 targetNodeId = parallelNodeTargets.iterator().next();
var parallelNode = new ParallelNode(e.sourceId(), targetNodeId, actions, actionNodeIds, keyStrategyMap,
compileConfig);
nodeFactories.put(parallelNode.id(), parallelNode.actionFactory());
edges.put(e.sourceId(), new EdgeValue(parallelNode.id()));
edges.put(parallelNode.id(), new EdgeValue(targetNodeId));
}View on GitHub (pinned to f82da0b50f)
Solutions
- Read the '. Cause:' message and the wrapped GraphStateException to find the failing node.
- Fix the underlying GraphStateException for that node's action (schema/key issues usually).
- Test node actions individually before including them in parallel branches.
Example fix
// before
.addParallelBranch(List.of("brokenNode", "okNode"), ...) // brokenNode action throws at compile
// after
// fix brokenNode's action so its factory passes compileConfig validation
.addNode("brokenNode", AsyncNodeAction.node_async(validAction)) Defensive patterns
Strategy: try-catch
Validate before calling
for (String id : parallelTargets) { assert nodeActionCompiles(id); } // compile each action standalone first Try / catch
try { compiled = graph.compile(cfg); } catch (RuntimeException e) { log.error("Parallel node {} failed: cause={}", extractTarget(e), e.getCause(), e); } Prevention
- Ensure each node in parallel branches has a factory that succeeds with the same compileConfig.
- Test parallel branch graphs in isolation.
- Keep action factories free of config-dependent side effects.
When it happens
Trigger: An error boundary/lifecycle or action factory for a node participating in a parallel branch throws during factory.apply(compileConfig) — e.g. an action whose compile-time checks fail (invalid keys, bad state schema).
Common situations: Parallel branches containing nodes with misconfigured actions; subgraphs inside parallel branches failing compile-time validation; node factories that depend on uninitialized config.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Schema validation failed:
- recursionLimit must be > 0!
- Conditional multi-command mapping from node '
- Failed to create node action for nodeId:
- subgraph not support start with parallel branches yet!
AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09).
Data as JSON: /api/errors/1d18a4ff50313a45.
Report an issue: GitHub.