{"record":{"id":"cec9f44478b30119","repo":"deeplearning4j/deeplearning4j","slug":"tried-to-combine-incompatible-accu-class-name-cec9f4","errorCode":null,"errorMessage":"Tried to combine() incompatible <accu class name> operator whereAggregableStringPrepend expected","messagePattern":"Tried to combine\\(\\) incompatible <accu class name> operator whereAggregableStringPrepend expected","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"datavec/datavec-api/src/main/java/org/datavec/api/transform/ops/StringAggregatorImpls.java","lineNumber":63,"sourceCode":"        @Override\n        public void accept(String s) {\n            sb.append(s);\n        }\n\n        @Override\n        public Writable get() {\n            return new Text(sb.toString());\n        }\n    }\n\n    public static class AggregableStringPrepend extends AggregableStringReduce {\n\n        @Override\n        public <W extends IAggregableReduceOp<String, Writable>> void combine(W accu) {\n            if (accu instanceof AggregableStringPrepend)\n                sb.append(((AggregableStringPrepend) accu).getSb());\n            else\n                throw new UnsupportedOperationException(\"Tried to combine() incompatible \" + accu.getClass().getName()\n                                + \" operator where\" + this.getClass().getName() + \" expected\");\n        }\n\n        @Override\n        public void accept(String s) {\n            String rev = new StringBuilder(s).reverse().toString();\n            sb.append(rev);\n        }\n\n        @Override\n        public Writable get() {\n            return new Text(sb.reverse().toString());\n        }\n    }\n\n}\n","sourceCodeStart":45,"sourceCodeEnd":80,"githubUrl":"https://github.com/deeplearning4j/deeplearning4j/blob/4c22ac5fe4a8350d05d224e7f4499429f7f69c93/datavec/datavec-api/src/main/java/org/datavec/api/transform/ops/StringAggregatorImpls.java#L45-L80","documentation":"AggregableStringPrepend.combine() only accepts another AggregableStringPrepend, merging the other's StringBuilder into its own. Any other accumulator class triggers UnsupportedOperationException. It means reducers configured as Prepend were combined with accumulators from a different reducer.","triggerScenarios":"Calling combine() on an AggregableStringPrepend with e.g. AggregableStringAppend or another reducer's accumulator — typically when merging partial reduce results across partitions/workers.","commonSituations":"Mixed ReduceOp.Prepend/Append configuration for the same string column across pipeline stages; inconsistent reducer lists between map and reduce sides of a distributed reduction.","solutions":["Use the same reducer (Prepend everywhere) for accumulators that will be combined into an AggregableStringPrepend.","Match the accu class name in the message against your reducer configuration and fix the mismatch at op creation time.","Note also that Prepend reverses each accepted string internally; verify your expected output order isn't a sign you meant to use Append."],"exampleFix":"// before\nprependOp.combine(appendOp);\n// after\nif (appendOp instanceof AggregableStringPrepend) prependOp.combine(appendOp);","handlingStrategy":"validation","validationCode":"if (!(accu instanceof AggregableStringPrepend)) throw new IllegalArgumentException(\"Prepend reducers can only combine with Prepend reducers, got \" + accu.getClass().getName());","typeGuard":"boolean combinable = accu instanceof AggregableStringPrepend;","tryCatchPattern":"try { prependOp.combine(accu); } catch (UnsupportedOperationException e) { throw new IllegalStateException(\"Reducer type mismatch (Prepend vs \" + accu.getClass().getSimpleName() + \")\", e); }","preventionTips":["Pick Append or Prepend once per column and use it consistently.","Remember Prepend reverses each accepted string; confirm intended semantics before configuring.","Test end-to-end schema inference (getSchemaAfterStep) on pipelines containing string reducers."],"tags":["unsupported-operation","type-mismatch","datavec","string-reduce"],"backgroundTag":"unsupported-operation","analyzedSha":"4c22ac5fe4a8350d05d224e7f4499429f7f69c93","analyzedAt":"2026-09-07T05:27:04.714Z","contentChangedAt":"2026-09-07T05:27:04.714Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}