{"record":{"id":"831527ac3d3bedeb","repo":"alibaba/spring-ai-alibaba","slug":"outputkey-must-not-be-null-or-empty","errorCode":null,"errorMessage":"outputKey must not be null or empty","messagePattern":"outputKey must not be null or empty","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-agent-framework/src/main/java/com/alibaba/cloud/ai/graph/agent/flow/node/ParallelResultAggregator.java","lineNumber":81,"sourceCode":"\t\treturn updatedState;\n\t}\n\n\tpublic static Builder builder() {\n\t\treturn new Builder();\n\t}\n\n\tpublic static class Builder {\n\n\t\tprivate String outputKey;\n\n\t\tpublic Builder outputKey(String outputKey) {\n\t\t\tthis.outputKey = outputKey;\n\t\t\treturn this;\n\t\t}\n\n\t\tpublic ParallelResultAggregator build() {\n\t\t\tif (outputKey == null || outputKey.trim().isEmpty()) {\n\t\t\t\tthrow new IllegalArgumentException(\"outputKey must not be null or empty\");\n\t\t\t}\n\t\t\treturn new ParallelResultAggregator(outputKey);\n\t\t}\n\n\t}\n\n}\n","sourceCodeStart":63,"sourceCodeEnd":89,"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/ParallelResultAggregator.java#L63-L89","documentation":"ParallelResultAggregator.Builder.build() throws when outputKey is null or blank. The aggregator writes the merged parallel results into state under this key, so it is mandatory for the node to function.","triggerScenarios":"new ParallelResultAggregator.Builder().build() without .outputKey(...), or outputKey(\"\") / outputKey(\"  \").","commonSituations":"outputKey sourced from a nullable config property; wiring the aggregator node in a graph builder and skipping the key; renaming a state key and leaving the aggregator call stale.","solutions":["Call .outputKey(\"<state-key>\") before .build()","Ensure the config/source feeding the key returns a non-blank string","Check the surrounding graph wiring reuses the same key when reading the aggregated result"],"exampleFix":"// before\nnew ParallelResultAggregator.Builder().build();\n// after\nnew ParallelResultAggregator.Builder().outputKey(\"parallel-results\").build();","handlingStrategy":"validation","validationCode":"if (outputKey == null || outputKey.isBlank()) throw new IllegalArgumentException(\"outputKey required for ParallelResultAggregator\");","typeGuard":"boolean validKey(String k) { return k != null && !k.isBlank(); }","tryCatchPattern":"try { node = aggregatorBuilder.build(); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"outputKey must not be null\")) { /* set key and rebuild */ } else throw e; }","preventionTips":["Always chain .outputKey(...) before .build()","Reuse a constant for the state key used by both writer and readers","Validate aggregator keys against the graph state schema"],"tags":["validation","builder","output-key"],"backgroundTag":"empty-required-field","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"}