{"record":{"id":"17d70e512cb6c11a","repo":"pentaho/pentaho-kettle","slug":"unable-to-clone-row-while-adding-rows-to-the-terminator","errorCode":null,"errorMessage":"Unable to clone row while adding rows to the terminator buffer","messagePattern":"Unable to clone row while adding rows to the terminator buffer","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/step/BaseStep.java","lineNumber":1636,"sourceCode":"      try {\n        Thread.sleep( 1 );\n      } catch ( InterruptedException e ) {\n        throw new KettleStepException( e );\n      }\n    }\n\n    // call all row listeners...\n    //\n    for ( RowListener listener : rowListeners ) {\n      listener.rowWrittenEvent( rowMeta, row );\n    }\n\n    // Keep adding to terminator_rows buffer...\n    if ( terminator && terminator_rows != null ) {\n      try {\n        terminator_rows.add( rowMeta.cloneRow( row ) );\n      } catch ( KettleValueException e ) {\n        throw new KettleStepException( \"Unable to clone row while adding rows to the terminator buffer\", e );\n      }\n    }\n\n    if ( stopped.get() ) {\n      if ( log.isDebug() ) {\n        logDebug( BaseMessages.getString( PKG, \"BaseStep.Log.StopPuttingARow\" ) );\n      }\n      stopAll();\n      return;\n    }\n\n    // Don't distribute or anything, only go to this rowset!\n    //\n    while ( !rowSet.putRow( rowMeta, row ) ) {\n      if ( isStopped() ) {\n        break;\n      }\n    }","sourceCodeStart":1618,"sourceCodeEnd":1654,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/step/BaseStep.java#L1618-L1654","documentation":"If a step is configured with a terminator (terminator_rows buffer, used e.g. by 'Abort'/'Injector' style tracking), BaseStep clones each row before adding it to the buffer. A KettleValueException from rowMeta.cloneRow(row) is wrapped in this KettleStepException. It means the current row cannot be duplicated for the terminator buffer.","triggerScenarios":"putRow() called on a step with the terminator flag enabled while the row contains a value that RowMeta.cloneRow cannot copy (incompatible value object for declared metadata).","commonSituations":"Terminating/abort steps downstream combined with rows carrying custom or corrupted value data; hand-constructed rows whose objects do not match the RowMeta value types; plugin version mismatches.","solutions":["Disable the terminator option on the step if the buffered rows are not needed.","Fix the offending field value/type identified from the chained KettleValueException cause.","Normalize row data upstream (Select values / value conversion) so every field matches its declared type.","Catch KettleStepException around putRow and log the failing row for inspection."],"exampleFix":"// before\nstep.setTerminator(true); // with rows containing custom objects\n\n// after: either disable terminator or normalize data first\n// Add a 'Select values' step converting fields to standard types before putRow","handlingStrategy":"try-catch","validationCode":"if (rowMeta.size() != row.length) {\n  throw new IllegalArgumentException(\"row data length does not match metadata\");\n}","typeGuard":"boolean isCloneable(Object[] row) {\n  return row != null && Arrays.stream(row).allMatch(v -> v == null || v instanceof String || v instanceof Number || v instanceof Date || v instanceof Boolean || v instanceof byte[]);\n}","tryCatchPattern":"try {\n  putRow(rowMeta, row);\n} catch (KettleStepException e) {\n  if (e.getMessage().contains(\"terminator buffer\")) {\n    logError(\"Row cannot be cloned for terminator buffer: \" + Arrays.toString(row), e);\n  } else { throw e; }\n}","preventionTips":["Disable terminator option when buffered rows are unnecessary","Normalize row values to standard types upstream","Verify row objects match declared value metadata"],"tags":["row-cloning","terminator-buffer","type-mismatch"],"backgroundTag":"type-mismatch","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}