{"record":{"id":"092f022f94340dca","repo":"pentaho/pentaho-kettle","slug":"unable-to-clone-row","errorCode":null,"errorMessage":"Unable to clone row","messagePattern":"Unable to clone row","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/shapefilereader/core/src/main/java/org/pentaho/di/shapefilereader/ShapeFileReader.java","lineNumber":142,"sourceCode":"\n          // The measure\n          outputRow[ outputIndex++ ] = new Double( eplm.measures[ j ] );\n\n          // The Values in the DBF file...\n          // PolyLimeM, point #\"+j+\", add dbf data\";\n          Object[] dbfData = si.getDbfData();\n          RowMetaInterface dbfMeta = si.getDbfMeta();\n          for ( int d = 0; d < dbfMeta.size(); d++ ) {\n            outputRow[ outputIndex++ ] = dbfData[ d ];\n          }\n\n          linesInput++;\n\n          // Put it out to the rest of the world...\n          try {\n            putRow( data.outputRowMeta, data.outputRowMeta.cloneRow( outputRow ) );\n          } catch ( KettleValueException e ) {\n            throw new KettleStepException( \"Unable to clone row\", e );\n          }\n        }\n        break;\n      case Shape.SHAPE_TYPE_POLYGON:\n        // ShapePolygon\";\n        ShapePolygon eplg = (ShapePolygon) si;\n        partnr = 0;\n        for ( int j = 0; j < eplg.nrpoints; j++ ) {\n          // PolyLime, point #\"+j;\n          for ( int k = 0; k < eplg.nrparts; k++ ) {\n            if ( j == eplg.part_starts[ k ] ) {\n              partnr++;\n            }\n          }\n\n          outputIndex = 0;\n\n          // adding the basics\";","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/shapefilereader/core/src/main/java/org/pentaho/di/shapefilereader/ShapeFileReader.java#L124-L160","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Inspect the shapefile's .dbf attribute types and ensure the declared row fields match the actual data","Repair/replace the corrupted shapefile (validate with ogrinfo or similar)","Adjust the step's field definitions so no incompatible/null-mismatched values enter the row","Update the Pentaho plugin/engine version — cloneRow bugs have been fixed in newer releases"],"exampleFix":"// hardening the emit path\ntry {\n  putRow( data.outputRowMeta, data.outputRowMeta.cloneRow( outputRow ) );\n} catch ( KettleValueException e ) {\n  logError( \"Row values: \" + data.outputRowMeta.getString(outputRow) );\n  throw new KettleStepException( \"Unable to clone row\", e );\n}","handlingStrategy":"try-catch","validationCode":"// pre-validate the shapefile attributes\n// ogrinfo -al myshape.shp  (check field types and nulls before ingesting)","typeGuard":null,"tryCatchPattern":"try {\n  step.run();\n} catch ( KettleStepException e ) {\n  if ( e.getMessage().equals( \"Unable to clone row\" ) ) {\n    logError( \"Row value could not be cloned — inspect shapefile .dbf types: \" + e.getCause() );\n  } else { throw e; }\n}","preventionTips":["Normalize shapefiles with ogr2ogr before ingestion","Check .dbf field types against the step's declared output fields","Log and inspect the cause exception to identify the failing field"],"tags":["shapefile","kettle","row-clone"],"backgroundTag":"internal-invariant-violation","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"}