{"record":{"id":"101cb4e3fabc4c9d","repo":"pentaho/pentaho-kettle","slug":"the-function-call-putrow-requires-1-argument-the-output-row","errorCode":null,"errorMessage":"The function call putRow requires 1 argument : the output row data (Object[])","messagePattern":"The function call putRow requires 1 argument : the output row data \\(Object\\[\\]\\)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java","lineNumber":1943,"sourceCode":"    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;\n          step.putRow( step.getOutputRowMeta(), newRow );\n        }\n\n      } catch ( Exception e ) {\n        throw new RuntimeException( \"Unable to pass the new row to the next step(s) because of an error: \"\n          + Const.CR + e.toString() );\n      }\n    } else {\n      throw new RuntimeException( \"The function call putRow requires 1 argument : the output row data (Object[])\" );\n    }\n  }\n\n  public static void deleteFile( Bowl bowl, ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,\n    Object FunctionContext ) {\n\n    try {\n      if ( ArgList.length == 1 && !isNull( ArgList[0] ) && !isUndefined( ArgList[0] ) ) {\n        // Object act = actualObject.get(\"_step_\", actualObject);\n        // ScriptValuesMod act = (ScriptValuesMod)Context.toType(scm_delete, ScriptValuesMod.class);\n\n        FileObject fileObject = null;\n\n        try {\n          fileObject = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] );\n          if ( fileObject.exists() ) {\n            if ( fileObject.getType() == FileType.FILE ) {\n              if ( !fileObject.delete() ) {","sourceCodeStart":1925,"sourceCodeEnd":1961,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java#L1925-L1961","documentation":"The JavaScript transform's putRow() helper in ScriptAddedFunctions validates the argument list before passing a row downstream. It requires exactly one argument: the output row as an Object[] (Kettle row array). If ArgList is null, empty, or contains more than one element, the function refuses to run and throws this RuntimeException.","triggerScenarios":"Calling putRow() with no arguments, calling putRow(row, extraArg), or calling putRow(null) from a JavaScript/Script step so that ArgList.length != 1.","commonSituations":"Copy-pasted JavaScript snippets where putRow is called with leftover arguments; scripts written for a different API (e.g. putRow(row, true) variants); refactored scripts where the row variable was removed or renamed and a stale call remains.","solutions":["Pass exactly one argument: putRow(new Object[] { value1, value2 }) or putRow(row).","If you intended to send the input row through, store it first (var row = getInputRow(); ...) and pass that single variable.","Remove any extra boolean/context arguments from the putRow call; this API accepts only the row array.","Check the script for multiple putRow overloads/typos (e.g. putRow vs putRowInstr) and use the documented one-argument form."],"exampleFix":"// before\nputRow(row, true);\n// after\nputRow(row);","handlingStrategy":"validation","validationCode":"// JavaScript in the Script step\nvar row = getInputRow();\nif (row == null) { throw new Error('putRow requires a row array'); }\nputRow(row); // exactly one argument","typeGuard":"function isRowArray(r) { return r != null && Array.isArray(r); }","tryCatchPattern":null,"preventionTips":["Always call putRow with a single row-array argument","Store the input row in a variable before modifying it","Grep scripts for putRow( calls with multiple arguments during review"],"tags":["javascript","script-transform","arguments","kettle"],"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"}