pentaho/pentaho-kettle · error · KettleStepException

Unable to clone row

Error message

Unable to clone row

What it means

Thrown in ShapeFileReader.processRow when cloning the output row (outputRowMeta.cloneRow) fails with a KettleValueException while emitting SHAPE_TYPE_MULTI_POINT records. Rows must be cloned before putRow because the reader reuses the row buffer for the next shape.

Solutions

  1. Inspect the shapefile's .dbf attribute types and ensure the declared row fields match the actual data
  2. Repair/replace the corrupted shapefile (validate with ogrinfo or similar)
  3. Adjust the step's field definitions so no incompatible/null-mismatched values enter the row
  4. Update the Pentaho plugin/engine version — cloneRow bugs have been fixed in newer releases

Example fix

// hardening the emit path
try {
  putRow( data.outputRowMeta, data.outputRowMeta.cloneRow( outputRow ) );
} catch ( KettleValueException e ) {
  logError( "Row values: " + data.outputRowMeta.getString(outputRow) );
  throw new KettleStepException( "Unable to clone row", e );
}
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-validate the shapefile attributes
// ogrinfo -al myshape.shp  (check field types and nulls before ingesting)

Try / catch

try {
  step.run();
} catch ( KettleStepException e ) {
  if ( e.getMessage().equals( "Unable to clone row" ) ) {
    logError( "Row value could not be cloned — inspect shapefile .dbf types: " + e.getCause() );
  } else { throw e; }
}

Prevention

When it happens

Trigger: putRow's cloneRow throws for a multipoint shape row — typically due to a value type in the output row meta that cannot be cloned (null value vs declared type mismatch, custom object value in the row).

Common situations: Shapefile attribute (.dbf) field types not mapping cleanly to Kettle value types; corrupted shapefile records producing null/malformed values; modified getFields logic introducing an incompatible field type.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/092f022f94340dca. Report an issue: GitHub.

Appendix: source

Thrown at plugins/shapefilereader/core/src/main/java/org/pentaho/di/shapefilereader/ShapeFileReader.java:142

          // The measure
          outputRow[ outputIndex++ ] = new Double( eplm.measures[ j ] );

          // The Values in the DBF file...
          // PolyLimeM, point #"+j+", add dbf data";
          Object[] dbfData = si.getDbfData();
          RowMetaInterface dbfMeta = si.getDbfMeta();
          for ( int d = 0; d < dbfMeta.size(); d++ ) {
            outputRow[ outputIndex++ ] = dbfData[ d ];
          }

          linesInput++;

          // Put it out to the rest of the world...
          try {
            putRow( data.outputRowMeta, data.outputRowMeta.cloneRow( outputRow ) );
          } catch ( KettleValueException e ) {
            throw new KettleStepException( "Unable to clone row", e );
          }
        }
        break;
      case Shape.SHAPE_TYPE_POLYGON:
        // ShapePolygon";
        ShapePolygon eplg = (ShapePolygon) si;
        partnr = 0;
        for ( int j = 0; j < eplg.nrpoints; j++ ) {
          // PolyLime, point #"+j;
          for ( int k = 0; k < eplg.nrparts; k++ ) {
            if ( j == eplg.part_starts[ k ] ) {
              partnr++;
            }
          }

          outputIndex = 0;

          // adding the basics";

View on GitHub (pinned to f3058517a1)