{"record":{"id":"8fdce68deeab6b50","repo":"alibaba/spring-ai-alibaba","slug":"no-output-found-for-sub-agent-outputkey","errorCode":null,"errorMessage":"No output found for sub-agent: {} (outputKey: {})","messagePattern":"No output found for sub-agent: (.+?) \\(outputKey: (.+?)\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"spring-ai-alibaba-agent-framework/src/main/java/com/alibaba/cloud/ai/graph/agent/flow/node/EnhancedParallelResultAggregator.java","lineNumber":130,"sourceCode":"\t\t\tif (subAgentOutputKey != null) {\n\t\t\t\tOptional<Object> agentResult = state.value(subAgentOutputKey);\n\t\t\t\tif (agentResult.isPresent()) {\n\t\t\t\t\tif (agentResult.get() instanceof GraphResponse<?> graphResponse) {\n\t\t\t\t\t\tif (graphResponse.resultValue().isPresent() && graphResponse.resultValue().get() instanceof Map subGraphState) {\n\t\t\t\t\t\t\tsubAgentResults.put(subAgentOutputKey, subGraphState.get(subAgentOutputKey));\n\t\t\t\t\t\t\t// Extract extra state data from sub-graph (e.g., data written via ToolContext)\n\t\t\t\t\t\t\textractExtraStateFromSubGraph(subGraphState, allOutputKeys, extraStateFromSubAgents);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsubAgentResults.put(subAgentOutputKey, graphResponse.resultValue().get());\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsubAgentResults.put(subAgentOutputKey, agentResult.get());\n\t\t\t\t\t}\n\t\t\t\t\tlogger.debug(\"Collected result from {}: {} = {}\", subAgent.name(), subAgentOutputKey,\n\t\t\t\t\t\t\tagentResult.get());\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlogger.warn(\"No output found for sub-agent: {} (outputKey: {})\", subAgent.name(),\n\t\t\t\t\t\t\tsubAgentOutputKey);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Apply merge strategy if provided\n\t\tObject finalResult;\n\t\tif (mergeStrategy instanceof ParallelAgent.MergeStrategy strategy) {\n\t\t\tfinalResult = strategy.merge(subAgentResults, state);\n\t\t}\n\t\telse {\n\t\t\t// Default behavior: return all results as a map\n\t\t\tfinalResult = new HashMap<>(subAgentResults);\n\t\t}\n\n\t\t// Only add the merged result if outputKey is not null\n\t\tif (outputKey != null && !outputKey.trim().isEmpty()) {\n\t\t\tresult.put(outputKey, finalResult);","sourceCodeStart":112,"sourceCodeEnd":148,"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/EnhancedParallelResultAggregator.java#L112-L148","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify each sub-agent's outputKey matches the key it actually writes to state","Ensure sub-agents always produce output (check their logs for failures)","Provide a default/fallback value in the aggregator for missing outputs","Enable debug logging ('Collected result from ...') to trace which key each agent writes"],"exampleFix":"// before\nReactAgent.builder().name(\"a\").model(model).build(); // writes nothing to state\n// after\nReactAgent.builder().name(\"a\").model(model).outputKey(\"a_result\").build(); // key matches aggregator lookup","handlingStrategy":"fallback","validationCode":"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); } }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Match aggregator lookup keys exactly with sub-agent outputKeys","Monitor sub-agent failures — a missing output usually means the agent errored or returned early","Use debug logging of 'Collected result from' lines to verify all keys are populated pre-merge"],"tags":["parallel-agent","result-aggregation","missing-output"],"backgroundTag":"empty-result-set","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"}