alibaba/spring-ai-alibaba · error · RuntimeException
Failed to create node action for nodeId:
Error message
Failed to create node action for nodeId:
What it means
getNodeAction looks up a node's ActionFactory and applies it; a GraphStateException raised by the factory is rethrown as a RuntimeException ('Failed to create node action for nodeId: <id>'). The node exists in the graph but its action cannot be constructed under the current compile config.
Source
Thrown at spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/CompiledGraph.java:505
/**
* Clone state over all state.
*
* @param data the data
* @return the over all state
*/
public OverAllState cloneState(Map<String, Object> data) throws IOException, ClassNotFoundException {
return new OverAllState(stateGraph.getStateSerializer().cloneObject(data).data(), getKeyStrategyMap());
}
/**
* Package-private access to nodes for ReactiveNodeGenerator.
*/
public AsyncNodeActionWithConfig getNodeAction(String nodeId) {
Node.ActionFactory factory = nodeFactories.get(nodeId);
try {
return factory != null ? factory.apply(compileConfig) : null;
} catch (GraphStateException e) {
throw new RuntimeException(
"Failed to create node action for nodeId: " + nodeId + ". Cause: " + e.getMessage(), e);
}
}
/**
* Package-private access to edges for ReactiveNodeGenerator
*/
public EdgeValue getEdge(String nodeId) {
return edges.get(nodeId);
}
/**
* Package-private access to keyStrategyMap for ReactiveNodeGenerator
*/
public Map<String, KeyStrategy> getKeyStrategyMap() {
return keyStrategyMap;
}
View on GitHub (pinned to f82da0b50f)
Solutions
- Read the wrapped cause message for the specific validation that failed.
- Fix the node action factory so apply(compileConfig) succeeds.
- Check nodeId spelling; ensure the node was added with a valid action.
Example fix
// before
var action = compiledGraph.getNodeAction("mySubGraphNode"); // subgraph invalid
// after
// validate the subgraph compiles standalone first:
var subCompiled = subGraph.compile();
var action = compiledGraph.getNodeAction("mySubGraphNode"); Defensive patterns
Strategy: try-catch
Validate before calling
if (!compiled.getGraph().nodes().containsKey(nodeId)) throw new IllegalArgumentException("Unknown node: " + nodeId); Try / catch
try { action = compiled.getNodeAction(id); } catch (RuntimeException e) { log.error("Node {} action failed: {}", id, e.getCause().getMessage(), e); } Prevention
- Compile subgraphs standalone before embedding them as nodes.
- Inspect the wrapped GraphStateException cause — it names the real validation failure.
- Avoid calling getNodeAction for nodes whose factories depend on later-initialized state.
When it happens
Trigger: Calling compiledGraph.getNodeAction(nodeId) (directly or during graph execution) where the node's action factory throws — e.g. subgraph preprocessing failures, invalid state key usage, unresolvable config.
Common situations: Nodes wrapping subgraphs that fail ProcessedNodesEdgesAndConfig validation; actions capturing invalid state schemas; calling getNodeAction before dependencies (like a compiled subgraph) are ready.
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:
- Failed to create parallel node action for target:
- Failed to check interruptAfter hook for streaming node
- Failed to create parallel node action for target:
- Failed to create item hash
AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09).
Data as JSON: /api/errors/c7b8c5900a1051f5.
Report an issue: GitHub.