{"record":{"id":"ad717d3d482d8cb1","repo":"alibaba/spring-ai-alibaba","slug":"routingagent-attempt-returned-empty-agent","errorCode":null,"errorMessage":"RoutingAgent {} attempt {}/{} returned empty agent list","messagePattern":"RoutingAgent (.+?) attempt (.+?)/(.+?) returned empty agent list","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-agent-framework/src/main/java/com/alibaba/cloud/ai/graph/agent/flow/node/RoutingNode.java","lineNumber":266,"sourceCode":"\t\t\t\t\t\t\t.filter(agentName -> subAgents.stream().noneMatch(agent -> agent.name().equals(agentName)))\n\t\t\t\t\t\t\t.collect(Collectors.toList());\n\n\t\t\t\t\tif (invalidAgents.isEmpty()) {\n\t\t\t\t\t\tif (attempt > 0) {\n\t\t\t\t\t\t\tlogger.info(\"RoutingAgent {} succeeded on retry attempt {}. Routed to sub-agents: {}\",\n\t\t\t\t\t\t\t\t\trootAgent.name(), attempt, String.join(\", \", decisionValues));\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn decision;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tlastInvalidDecision = decisionValues;\n\t\t\t\t\t\tlogger.warn(\"RoutingAgent {} attempt {}/{} returned invalid agent names: {}\",\n\t\t\t\t\t\t\t\trootAgent.name(), attempt, maxRetries, invalidAgents);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlastInvalidDecision = Collections.emptyList();\n\t\t\t\t\tlogger.warn(\"RoutingAgent {} attempt {}/{} returned empty agent list\",\n\t\t\t\t\t\t\trootAgent.name(), attempt, maxRetries);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\tif (attempt == maxRetries) {\n\t\t\t\t\tlogger.error(\"RoutingAgent {} failed on final attempt {}/{}\", rootAgent.name(), attempt, maxRetries, e);\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\t\t\t\tlogger.warn(\"RoutingAgent {} attempt {}/{} encountered an error, will retry\", rootAgent.name(), attempt, maxRetries, e);\n\t\t\t}\n\t\t}\n\n\t\tthrow new IllegalStateException(\n\t\t\t\tString.format(\"Failed to get valid decision after %d retries. Last invalid decision: %s\",\n\t\t\t\t\t\tmaxRetries, lastInvalidDecision));\n\t}\n\n\t/**","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-agent-framework/src/main/java/com/alibaba/cloud/ai/graph/agent/flow/node/RoutingNode.java#L248-L284","documentation":"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.","triggerScenarios":"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.","commonSituations":"See trigger scenarios.","solutions":["Instruct the model that an empty selection is invalid","Configure a fallback agent for exhausted retries","Verify outputConverter parsing isn't dropping populated names"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}