alibaba/spring-ai-alibaba · warning

No output found for sub-agent

Error message

No output found for sub-agent: {} (outputKey: {})

What it means

EnhancedParallelResultAggregator.apply collects each sub-agent's output from the parent state using its outputKey. When no value is present for that key, it logs this warning and simply skips the sub-agent, so its contribution is missing from the aggregated result.

Solutions

  1. Verify each sub-agent's outputKey matches the key it actually writes to state
  2. Ensure sub-agents always produce output (check their logs for failures)
  3. Provide a default/fallback value in the aggregator for missing outputs
  4. Enable debug logging ('Collected result from ...') to trace which key each agent writes

Example fix

// before
ReactAgent.builder().name("a").model(model).build(); // writes nothing to state
// after
ReactAgent.builder().name("a").model(model).outputKey("a_result").build(); // key matches aggregator lookup
Defensive patterns

Strategy: fallback

Validate before calling

for (Agent s : subAgents) { String k = ((ReactAgent) s).getOutputKey(); if (k == null || parentState.value(k).isEmpty()) { log.warn("Agent {} will contribute no output (key={})", s.name(), k); } }

Prevention

When it happens

Trigger: apply() runs after parallel execution and Optional state lookup for (subAgent, subAgentOutputKey) is empty — the sub-agent produced no output or wrote under a different key.

Common situations: Sub-agent warned [1015]-style (no outputKey) so lookup key is null/default; sub-agent failed or returned early; outputKey typo mismatching the key the sub-agent writes.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

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

			if (subAgentOutputKey != null) {
				Optional<Object> agentResult = state.value(subAgentOutputKey);
				if (agentResult.isPresent()) {
					if (agentResult.get() instanceof GraphResponse<?> graphResponse) {
						if (graphResponse.resultValue().isPresent() && graphResponse.resultValue().get() instanceof Map subGraphState) {
							subAgentResults.put(subAgentOutputKey, subGraphState.get(subAgentOutputKey));
							// Extract extra state data from sub-graph (e.g., data written via ToolContext)
							extractExtraStateFromSubGraph(subGraphState, allOutputKeys, extraStateFromSubAgents);
						} else {
							subAgentResults.put(subAgentOutputKey, graphResponse.resultValue().get());
						}
					} else {
						subAgentResults.put(subAgentOutputKey, agentResult.get());
					}
					logger.debug("Collected result from {}: {} = {}", subAgent.name(), subAgentOutputKey,
							agentResult.get());
				}
				else {
					logger.warn("No output found for sub-agent: {} (outputKey: {})", subAgent.name(),
							subAgentOutputKey);
				}
			}
		}

		// Apply merge strategy if provided
		Object finalResult;
		if (mergeStrategy instanceof ParallelAgent.MergeStrategy strategy) {
			finalResult = strategy.merge(subAgentResults, state);
		}
		else {
			// Default behavior: return all results as a map
			finalResult = new HashMap<>(subAgentResults);
		}

		// Only add the merged result if outputKey is not null
		if (outputKey != null && !outputKey.trim().isEmpty()) {
			result.put(outputKey, finalResult);

View on GitHub (pinned to f82da0b50f)