{"record":{"id":"1e209eba2c686ef1","repo":"nathanmarz/storm","slug":"combiner-aggs-only-take-a-single-field-as-input-got-this","errorCode":null,"errorMessage":"Combiner aggs only take a single field as input. Got this instead: ","messagePattern":"Combiner aggs only take a single field as input\\. Got this instead: ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"storm-core/src/jvm/storm/trident/state/map/MapCombinerAggStateUpdater.java","lineNumber":49,"sourceCode":"import storm.trident.tuple.ComboList;\nimport storm.trident.tuple.TridentTuple;\nimport storm.trident.tuple.TridentTupleView.ProjectionFactory;\n\npublic class MapCombinerAggStateUpdater implements StateUpdater<MapState> {\n    CombinerAggregator _agg;\n    Fields _groupFields;\n    Fields _inputFields;\n    ProjectionFactory _groupFactory;\n    ProjectionFactory _inputFactory;\n    ComboList.Factory _factory;\n    \n    \n    public MapCombinerAggStateUpdater(CombinerAggregator agg, Fields groupFields, Fields inputFields) {\n        _agg = agg;\n        _groupFields = groupFields;\n        _inputFields = inputFields;\n        if(inputFields.size()!=1) {\n            throw new IllegalArgumentException(\"Combiner aggs only take a single field as input. Got this instead: \" + inputFields.toString());\n        }\n        _factory = new ComboList.Factory(groupFields.size(), inputFields.size());\n    }\n    \n\n    @Override\n    public void updateState(MapState map, List<TridentTuple> tuples, TridentCollector collector) {\n        List<List<Object>> groups = new ArrayList<List<Object>>(tuples.size());\n        List<ValueUpdater> updaters = new ArrayList<ValueUpdater>(tuples.size());\n                \n        for(TridentTuple t: tuples) {\n            groups.add(_groupFactory.create(t));\n            updaters.add(new CombinerValueUpdater(_agg,_inputFactory.create(t).getValue(0)));\n        }\n        List<Object> newVals = map.multiUpdate(groups, updaters);\n       \n        for(int i=0; i<tuples.size(); i++) {\n            List<Object> key = groups.get(i);","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/nathanmarz/storm/blob/cdb116e942666973bc4eaa0df098d5bab82739e7/storm-core/src/jvm/storm/trident/state/map/MapCombinerAggStateUpdater.java#L31-L67","documentation":"MapCombinerAggStateUpdater applies a CombinerAggregator over grouped state, and CombinerAggregators by contract reduce exactly one input field per tuple. The constructor validates inputFields and throws IllegalArgumentException if more or fewer than one field is supplied.","triggerScenarios":"Calling persistentAggregate with a CombinerAggregator (e.g. Count(), Sum(new Fields(\"x\"))) where the value Fields has size != 1, e.g. new Fields(\"a\",\"b\") or empty fields.","commonSituations":"Trying to aggregate multiple columns with a combiner agg; passing zero-arg Fields by mistake; converting a ReducerAggregator pipeline to CombinerAggregator without trimming fields.","solutions":["Pass exactly one field: persistentAggregate(state, new Sum(new Fields(\"value\")), new Fields(\"sum\"))","If multiple inputs are needed, combine them first with each() into a single field, or use a ReducerAggregator/Aggregator instead","Ensure the value fields selector excludes group fields"],"exampleFix":"// before\n.persistentAggregate(state, new Sum(), new Fields(\"a\", \"b\"), new Fields(\"sum\"))\n// after\n.persistentAggregate(state, new Sum(new Fields(\"a\")), new Fields(\"sum\"))","handlingStrategy":"validation","validationCode":"if (inputFields.size() != 1) {\n  throw new IllegalArgumentException(\"CombinerAggregator requires exactly one input field, got: \" + inputFields);\n}","typeGuard":null,"tryCatchPattern":"try {\n  stream.persistentAggregate(stateFactory, combinerAgg, valueFields, new Fields(\"out\"));\n} catch (IllegalArgumentException e) {\n  LOG.error(\"persistentAggregate field count invalid: \" + e.getMessage());\n}","preventionTips":["Always pass a single-field Fields to combiner aggregator persistentAggregate calls","Pre-combine multiple columns via each() into one field","Prefer ReducerAggregator when multiple fields are genuinely needed"],"tags":["storm","trident","aggregation","fields"],"backgroundTag":"invalid-argument-value","analyzedSha":"cdb116e942666973bc4eaa0df098d5bab82739e7","analyzedAt":"2026-09-12T14:30:00.714Z","contentChangedAt":"2026-09-12T14:30:00.714Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}