{"record":{"id":"41f029180916e72c","repo":"pentaho/pentaho-kettle","slug":"unable-to-get-the-input-row-metadata-because-of-an-error-41f029","errorCode":null,"errorMessage":"Unable to get the input row metadata because of an error: ","messagePattern":"Unable to get the input row metadata because of an error: ","errorType":"exception","errorClass":"RhinoRuntimeError","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java","lineNumber":1980,"sourceCode":"      throw Context.reportRuntimeError( \"The function call getOutputRowMeta doesn't require arguments.\" );\n    }\n  }\n\n  // Return the input row metadata\n  public static RowMetaInterface getInputRowMeta( Context actualContext, Scriptable actualObject,\n    Object[] ArgList, Function FunctionContext ) {\n    if ( ArgList.length == 0 ) {\n      try {\n        Object scmO = actualObject.get( \"_step_\", actualObject );\n        try {\n          ScriptValuesMod scm = (ScriptValuesMod) Context.jsToJava( scmO, ScriptValuesMod.class );\n          return scm.getInputRowMeta();\n        } catch ( Exception e ) {\n          ScriptValuesModDummy scm = (ScriptValuesModDummy) Context.jsToJava( scmO, ScriptValuesModDummy.class );\n          return scm.getInputRowMeta();\n        }\n      } catch ( Exception e ) {\n        throw Context.reportRuntimeError( \"Unable to get the input row metadata because of an error: \"\n          + Const.CR + e.toString() );\n      }\n    } else {\n      throw Context.reportRuntimeError( \"The function call getInputRowMeta doesn't require arguments.\" );\n    }\n  }\n\n  // Return the input row metadata\n  public static Object[] createRowCopy( Context actualContext, Scriptable actualObject, Object[] ArgList,\n    Function FunctionContext ) {\n    if ( ArgList.length == 1 ) {\n      try {\n        int newSize = (int) Math.round( Context.toNumber( ArgList[0] ) );\n\n        Object scmO = actualObject.get( \"row\", actualObject );\n        Object[] row = (Object[]) Context.jsToJava( scmO, ( new Object[] {} ).getClass() );\n\n        return RowDataUtil.createResizedCopy( row, newSize );","sourceCodeStart":1962,"sourceCodeEnd":1998,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java#L1962-L1998","documentation":"getInputRowMeta() fetches the incoming row metadata via the '_step_' object; any exception during step lookup or getInputRowMeta() invocation results in this Rhino runtime error with the underlying exception appended. It means the script could not access the input row structure.","triggerScenarios":"Calling getInputRowMeta() when the '_step_' binding cannot be converted to a step/dummy instance, or the step's getInputRowMeta() throws (e.g. metadata not yet available).","commonSituations":"Running the step with no input rows so input metadata is null; executing scripts in unit tests without a transformation context; using the function in a step type that doesn't expose input metadata.","solutions":["Ensure the step has an incoming hop so input row metadata is defined.","Run the transformation normally so the '_step_' object is properly bound.","Read the appended exception text to identify the root cause.","Wrap the call in a JS try/catch with a fallback."],"exampleFix":"// before\nvar inMeta = getInputRowMeta();\n// after\ntry { var inMeta = getInputRowMeta(); } catch (e) { var inMeta = null; }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { var m = getInputRowMeta(); } catch (e) { logError('getInputRowMeta failed: ' + e.message); var m = null; }","preventionTips":["Give the step an incoming hop so input metadata exists.","Call only during row processing, not init.","Inspect the appended exception text when it fires."],"tags":["javascript","row-metadata","pentaho"],"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"}