alibaba/spring-ai-alibaba · error · GraphStateException

'interruption after' on subgraph is not supported yet! consi

Error message

'interruption after' on subgraph is not supported yet! consider to use 'interruption before' node: '%s'

What it means

interruptsAfter (interruption after node execution) is not implemented for subgraph nodes. When the parent graph requests an interrupt after a subgraph node, the library throws this GraphStateException, suggesting 'interruption before' on the following node instead.

Source

Thrown at spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/ProcessedNodesEdgesAndConfig.java:143

			// Process END Nodes
			//
			var sgEdgesEnd = processedSubGraphEdges.edgesByTargetId(END);

			var edgeWithSubgraphSourceId = edges.edgeBySourceId(subgraphNode.id()).orElseThrow();

			if (edgeWithSubgraphSourceId.isParallel()) {
				throw new GraphStateException("subgraph not support routes to parallel branches yet!");
			}

			// Process Interruption (After) Subgraph(s)
			if (interruptsAfter.contains(subgraphNode.id())) {

				var exceptionMessage = (edgeWithSubgraphSourceId.target()
						.id() == null) ? "'interruption after' on subgraph is not supported yet!"
								: format(
										"'interruption after' on subgraph is not supported yet! consider to use 'interruption before' node: '%s'",
										edgeWithSubgraphSourceId.target().id());
				throw new GraphStateException(exceptionMessage);
			}

			sgEdgesEnd.stream()
					.map(e -> e.withSourceAndTargetIdsUpdated(subgraphNode, subgraphNode::formatId,
							id -> (Objects.equals(id, END) ? edgeWithSubgraphSourceId.target()
									: new EdgeValue(subgraphNode.formatId(id)))))
					.forEach(edges.elements::add);
			edges.elements.remove(edgeWithSubgraphSourceId);

			//
			// Process edges
			//
			processedSubGraphEdges.elements.stream()
					.filter(e -> !Objects.equals(e.sourceId(), START))
					.filter(e -> !e.anyMatchByTargetId(END))
					.map(e -> e.withSourceAndTargetIdsUpdated(subgraphNode, subgraphNode::formatId,
							id -> new EdgeValue(subgraphNode.formatId(id))))
					.forEach(edges.elements::add);

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Replace interrupt-after on the subgraph with interrupt-before on the node that follows it: .compile(interruptsBefore(Set.of("nextNode")))
  2. Add a no-op marker node right after the subgraph and interrupt before that node
  3. Move the interruption logic inside the subgraph itself if applicable
  4. If the edge target has an id, the message names it — use that node in interruptsBefore

Example fix

// before
app = outer.compile(interruptsAfter(Set.of("sub"), saver));
// after
app = outer.compile(interruptsBefore(Set.of("review"), saver)); // 'review' is the node after 'sub'
Defensive patterns

Strategy: validation

Validate before calling

Set<String> subgraphIds = parent.subgraphNodeIds();
if (interruptsAfter.stream().anyMatch(subgraphIds::contains))
    throw new IllegalStateException("use interruptsBefore on the successor node instead");

Try / catch

try { app = outer.compile(interruptsAfter(set, saver)); } catch (GraphStateException e) { if (e.getMessage().contains("interruption after' on subgraph")) { /* switch to interruptsBefore on next node */ } else throw e; }

Prevention

When it happens

Trigger: Calling compile with interruptsAfter (or addInterruptAfter) containing the id of a node that is a subgraph, e.g. .compile(interruptsAfter(Set.of("sub"))) where "sub" is an embedded StateGraph.

Common situations: Developers porting plain-node interrupt configs to graphs where some nodes were replaced by subgraphs; human-in-the-loop setups pausing right after a subgraph completes.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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