pentaho/pentaho-kettle · error · RuntimeException
The function call createRowCopy requires a single arguments…
Error message
The function call createRowCopy requires a single arguments : the new size of the row
What it means
Argument-count guard for the createRowCopy added function in ScriptAddedFunctions. createRowCopy requires exactly one argument — the new size of the row; any other argument count throws this RuntimeException.
Solutions
- Call createRowCopy with exactly one integer argument: the new row size.
- Populate the extra slots on the returned copy afterwards (e.g. newRow[oldSize] = value).
- Search the script for createRowCopy( and correct the argument list.
Example fix
// before var newRow = createRowCopy(3, firstName); // after var newRow = createRowCopy(3); newRow[2] = firstName;
Defensive patterns
Strategy: validation
Validate before calling
if (arguments.length !== 1 || typeof arguments[0] !== 'number') throw new Error('createRowCopy requires exactly one integer: the new row size'); Try / catch
try { var r = createRowCopy(2); } catch (e) { if (String(e).indexOf('requires a single arguments') !== -1) { /* correct the call site to one argument */ } throw e; } Prevention
- Always pass exactly one integer (the new size)
- Assign new field values on the returned copy, not via extra arguments
- Review copy-pasted Kettle samples for changed function signatures
When it happens
Trigger: Calling createRowCopy() with no arguments, or with two or more arguments, e.g. createRowCopy(size, extra) or createRowCopy(newSize, newData).
Common situations: Author assuming createRowCopy accepts the new field values along with the size (it does not), or translating older Kettle JavaScript samples incorrectly.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- The function call getInputRowMeta doesn't require arguments.
- Unable to create a row copy:
- Unable to get the input row metadata because of an error:
- Unable to pass the new row to the next step(s) because of…
- Calculator.ErrorInStepRunning
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/b4a267fded8234ac.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:1916
}
}
// Return the input row metadata
public static Object[] createRowCopy( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,
Object FunctionContext ) {
if ( ArgList.length == 1 ) {
try {
int newSize = (int) Math.round( (Double) ArgList[0] );
Object scmO = actualObject.get( "row" );
Object[] row = (Object[]) scmO; // TODO AKRETION ensure
return RowDataUtil.createResizedCopy( row, newSize );
} catch ( Exception e ) {
throw new RuntimeException( "Unable to create a row copy: " + Const.CR + e.toString() );
}
} else {
throw new RuntimeException(
"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( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,
Object FunctionContext ) {
if ( ArgList.length == 1 ) {
try {
Object[] newRow = (Object[]) ArgList[0];
Object scmO = actualObject.get( "_step_" );
try {
Script step = (Script) scmO;
step.putRow( step.getOutputRowMeta(), newRow );
} catch ( Exception e ) {
ScriptDummy step = (ScriptDummy) scmO;View on GitHub (pinned to f3058517a1)