alibaba/spring-ai-alibaba · error

RoutingAgent attempt / returned empty agent list

Error message

RoutingAgent {} attempt {}/{} returned empty agent list

What it means

RoutingNode.getDecisionWithRetry logs a warning when the RoutingDecision returned an empty agent-name list — the model produced a decision that selects nothing. Handled like an invalid decision: retry with feedback, then fallback after retries are exhausted.

Solutions

  1. Instruct the model that an empty selection is invalid
  2. Configure a fallback agent for exhausted retries
  3. Verify outputConverter parsing isn't dropping populated names
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at spring-ai-alibaba-agent-framework/src/main/java/com/alibaba/cloud/ai/graph/agent/flow/node/RoutingNode.java:266 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at spring-ai-alibaba-agent-framework/src/main/java/com/alibaba/cloud/ai/graph/agent/flow/node/RoutingNode.java:266

							.filter(agentName -> subAgents.stream().noneMatch(agent -> agent.name().equals(agentName)))
							.collect(Collectors.toList());

					if (invalidAgents.isEmpty()) {
						if (attempt > 0) {
							logger.info("RoutingAgent {} succeeded on retry attempt {}. Routed to sub-agents: {}",
									rootAgent.name(), attempt, String.join(", ", decisionValues));
						}
						return decision;
					}
					else {
						lastInvalidDecision = decisionValues;
						logger.warn("RoutingAgent {} attempt {}/{} returned invalid agent names: {}",
								rootAgent.name(), attempt, maxRetries, invalidAgents);
					}
				}
				else {
					lastInvalidDecision = Collections.emptyList();
					logger.warn("RoutingAgent {} attempt {}/{} returned empty agent list",
							rootAgent.name(), attempt, maxRetries);
				}
			}
			catch (Exception e) {
				if (attempt == maxRetries) {
					logger.error("RoutingAgent {} failed on final attempt {}/{}", rootAgent.name(), attempt, maxRetries, e);
					throw e;
				}
				logger.warn("RoutingAgent {} attempt {}/{} encountered an error, will retry", rootAgent.name(), attempt, maxRetries, e);
			}
		}

		throw new IllegalStateException(
				String.format("Failed to get valid decision after %d retries. Last invalid decision: %s",
						maxRetries, lastInvalidDecision));
	}

	/**

View on GitHub (pinned to f82da0b50f)