{"record":{"id":"b4a267fded8234ac","repo":"pentaho/pentaho-kettle","slug":"the-function-call-createrowcopy-requires-a-single-arguments","errorCode":null,"errorMessage":"The function call createRowCopy requires a single arguments : the new size of the row","messagePattern":"The function call createRowCopy requires a single arguments : the new size of the row","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java","lineNumber":1916,"sourceCode":"    }\n  }\n\n  // Return the input row metadata\n  public static Object[] createRowCopy( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,\n    Object FunctionContext ) {\n    if ( ArgList.length == 1 ) {\n      try {\n        int newSize = (int) Math.round( (Double) ArgList[0] );\n\n        Object scmO = actualObject.get( \"row\" );\n        Object[] row = (Object[]) scmO; // TODO AKRETION ensure\n\n        return RowDataUtil.createResizedCopy( row, newSize );\n      } catch ( Exception e ) {\n        throw new RuntimeException( \"Unable to create a row copy: \" + Const.CR + e.toString() );\n      }\n    } else {\n      throw new RuntimeException(\n        \"The function call createRowCopy requires a single arguments : the new size of the row\" );\n    }\n  }\n\n  // put a row out to the next steps...\n  //\n  public static void putRow( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,\n    Object FunctionContext ) {\n    if ( ArgList.length == 1 ) {\n      try {\n        Object[] newRow = (Object[]) ArgList[0];\n\n        Object scmO = actualObject.get( \"_step_\" );\n        try {\n          Script step = (Script) scmO;\n          step.putRow( step.getOutputRowMeta(), newRow );\n        } catch ( Exception e ) {\n          ScriptDummy step = (ScriptDummy) scmO;","sourceCodeStart":1898,"sourceCodeEnd":1934,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java#L1898-L1934","documentation":"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.","triggerScenarios":"Calling createRowCopy() with no arguments, or with two or more arguments, e.g. createRowCopy(size, extra) or createRowCopy(newSize, newData).","commonSituations":"Author assuming createRowCopy accepts the new field values along with the size (it does not), or translating older Kettle JavaScript samples incorrectly.","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."],"exampleFix":"// before\nvar newRow = createRowCopy(3, firstName);\n// after\nvar newRow = createRowCopy(3);\nnewRow[2] = firstName;","handlingStrategy":"validation","validationCode":"if (arguments.length !== 1 || typeof arguments[0] !== 'number') throw new Error('createRowCopy requires exactly one integer: the new row size');","typeGuard":null,"tryCatchPattern":"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; }","preventionTips":["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"],"tags":["pdi","kettle","script","argument-count","runtime"],"backgroundTag":"missing-required-argument","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"}