{"record":{"id":"ff19094c4082e87d","repo":"pentaho/pentaho-kettle","slug":"unable-to-get-the-output-row-metadata-because-of-an-error-ff1909","errorCode":null,"errorMessage":"Unable to get the output row metadata because of an error: ","messagePattern":"Unable to get the output 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":1958,"sourceCode":"    }\n    return sRC;\n  }\n\n  // Return the output row metadata\n  public static RowMetaInterface getOutputRowMeta( 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.getOutputRowMeta();\n        } catch ( Exception e ) {\n          ScriptValuesModDummy scm = (ScriptValuesModDummy) Context.jsToJava( scmO, ScriptValuesModDummy.class );\n          return scm.getOutputRowMeta();\n        }\n      } catch ( Exception e ) {\n        throw Context.reportRuntimeError( \"Unable to get the output row metadata because of an error: \"\n          + Const.CR + e.toString() );\n      }\n    } else {\n      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 );","sourceCodeStart":1940,"sourceCodeEnd":1976,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java#L1940-L1976","documentation":"getOutputRowMeta() retrieves the row metadata (RowMetaInterface) from the step by reading the '_step_' object; if any exception occurs while resolving the step or fetching metadata, it throws this Rhino runtime error with the exception appended after Const.CR. It signals the script could not access the step's output row structure.","triggerScenarios":"Calling getOutputRowMeta() when the '_step_' scriptable property is missing or fails jsToJava conversion to ScriptValuesModDummy/StepInterface, or when getOutputRowMeta() on the step itself throws.","commonSituations":"Using getOutputRowMeta() during preview before row metadata exists; running the script in a context (e.g. test harness) without a real step instance; step not yet initialized.","solutions":["Ensure the script runs inside an actual ScriptValuesMod step execution, not a standalone engine.","Check the transformation initializes correctly and the step is connected so output metadata exists.","Inspect the appended exception (after the message) for the root cause, e.g. ClassCastException.","Guard in script: call getOutputRowMeta only after the first row flow or inside try/catch returning a fallback."],"exampleFix":"// before\nvar meta = getOutputRowMeta();\n// after\ntry { var meta = getOutputRowMeta(); } catch (e) { var meta = null; }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { var meta = getOutputRowMeta(); } catch (e) { logError('getOutputRowMeta failed: ' + e.message); var meta = null; }","preventionTips":["Only call metadata accessors during actual row processing.","Ensure the step is properly connected and initialized.","Read the exception appended after the message for root cause."],"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"}