pentaho/pentaho-kettle · error · RhinoRuntimeError

Unable to create a row copy:

Error message

Unable to create a row copy: 

What it means

createRowCopy(newSize) reads the 'row' scriptable property and converts it to an Object[] to build a resized copy via RowDataUtil.createResizedCopy; any failure (missing row binding, wrong type, null row) is reported as this Rhino runtime error with the exception appended. It indicates the script's current row could not be copied.

Solutions

  1. Verify the script runs in a step that exposes the 'row' object (ScriptValuesMod / User Defined Java Class style bindings).
  2. Pass an integer for the new row size, and include fields needed for appended columns.
  3. Check the appended exception (after the message) for the exact cause.
  4. Ensure a row is being processed (call it per-row, not at initialization).

Example fix

// before
var row2 = createRowCopy('5');
// after
var row2 = createRowCopy(5);
Defensive patterns

Strategy: try-catch

Validate before calling

// validate size before call
if (typeof newSize !== 'number' || newSize <= 0) throw new Error('createRowCopy needs positive integer size');

Try / catch

try { var row2 = createRowCopy(5); } catch (e) { logError('createRowCopy failed: ' + e.message); var row2 = null; }

Prevention

When it happens

Trigger: Calling createRowCopy(N) when the 'row' variable is not available in the step context, is not an Object[], or the resize operation throws (e.g. negative or invalid size).

Common situations: Using createRowCopy in steps that don't expose 'row'; calling it before the first row arrives; passing a non-integer size such as a string.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:2000

      }
    } else {
      throw Context.reportRuntimeError( "The function call getInputRowMeta doesn't require arguments." );
    }
  }

  // Return the input row metadata
  public static Object[] createRowCopy( Context actualContext, Scriptable actualObject, Object[] ArgList,
    Function FunctionContext ) {
    if ( ArgList.length == 1 ) {
      try {
        int newSize = (int) Math.round( Context.toNumber( ArgList[0] ) );

        Object scmO = actualObject.get( "row", actualObject );
        Object[] row = (Object[]) Context.jsToJava( scmO, ( new Object[] {} ).getClass() );

        return RowDataUtil.createResizedCopy( row, newSize );
      } catch ( Exception e ) {
        throw Context.reportRuntimeError( "Unable to create a row copy: " + Const.CR + e.toString() );
      }
    } else {
      throw Context
        .reportRuntimeError( "The function call createRowCopy requires a single arguments : the new size of the row" );
    }
  }

  // put a row out to the next steps...
  //
  public static void putRow( Context actualContext, Scriptable actualObject, Object[] ArgList,
    Function FunctionContext ) {
    if ( ArgList.length == 1 ) {
      try {
        Object[] newRow = (Object[]) Context.jsToJava( ArgList[0], ( new Object[] {} ).getClass() );

        Object scmO = actualObject.get( "_step_", actualObject );
        try {
          ScriptValuesMod step = (ScriptValuesMod) Context.jsToJava( scmO, ScriptValuesMod.class );

View on GitHub (pinned to f3058517a1)