alibaba/spring-ai-alibaba · error · IllegalStateException
No default output or error next node provided
Error message
No default output or error next node provided
What it means
The generated LLM node's routing lambda requires either a default next node or an error next node to decide where to go after execution. If both are absent, the generated code throws IllegalStateException at runtime.
Source
Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/generator/service/generator/workflow/sections/LLMNodeSection.java:140
catch (Exception e) {
try {
Thread.sleep(retryInterval);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
break;
}
}
}
// error handling
if (defaultOutput != null) {
return %s;
}
else if (errorNextNode != null) {
return Map.of(nextNodeKey, errorNextNode);
}
else {
throw new IllegalStateException("No default output or error next node provided");
}
};
}
""",
dialectType.equals(DSLDialectType.DIFY) ? "Map.of(outputKeyPrefix + \"text\", content)"
: "Map.of(outputKeyPrefix + \"output\", content, outputKeyPrefix + \"reasoning_content\", content)",
dialectType.equals(DSLDialectType.DIFY) ? "Map.of(outputKeyPrefix + \"text\", defaultOutput)"
: "Map.of(outputKeyPrefix + \"output\", defaultOutput, outputKeyPrefix + \"reasoning_content\", defaultOutput)");
}
@Override
public List<String> getImports() {
return List.of("org.springframework.ai.chat.messages.Message",
"org.springframework.ai.chat.messages.AssistantMessage",
"org.springframework.ai.chat.messages.MessageType",
"org.springframework.ai.chat.messages.SystemMessage",
"org.springframework.ai.chat.messages.UserMessage",
"com.alibaba.cloud.ai.dashscope.chat.DashScopeChatOptions",View on GitHub (pinned to f82da0b50f)
Solutions
- Add an outgoing edge from the LLM node to a downstream node (default output)
- Configure an error next node so failures route to an error handler branch
- Restructure the workflow so the LLM node is not unconditionally required to route
Example fix
// before
{"id": "llm1", ...} // no outgoing edges
// after
{"id": "llm1", ...}, {"source": "llm1", "target": "end1", "type": "default"} Defensive patterns
Strategy: validation
Validate before calling
boolean hasOutgoingEdge = edges.stream().anyMatch(e -> e.getSource().equals(llmNodeId) && ("default".equals(e.getType()) || "error".equals(e.getType()))); if (!hasOutgoingEdge) { throw new IllegalArgumentException("LLM node needs a default or error edge: " + llmNodeId); } Type guard
null
Try / catch
try { stateRouter.apply(state); } catch (IllegalStateException e) { log.error("LLM node routing failed: {}", e.getMessage()); } Prevention
- Validate graph connectivity before generation
- Require terminal nodes to be explicit END nodes
- Preserve default edges when editing imported DSLs
When it happens
Trigger: An LLM node in the DSL has no downstream edge marked as the default/normal output and no error edge, and the generated routing function executes.
Common situations: Dangling LLM node at the end of an incomplete workflow graph; edges deleted during DSL editing; imported DSL where the LLM node is terminal but the generator still emits routing code.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- WORKFLOW_CONFIG_INVALID
- invalid output
- Routing sub-agents must be BaseAgent for merge support
- Routing flow requires at least one sub-agent
- Routing flow requires a ChatModel for decision making
AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09).
Data as JSON: /api/errors/113530a016e1dc44.
Report an issue: GitHub.