pentaho/pentaho-kettle · error · RuntimeException

Unable to get the input row metadata because of an error:

Error message

Unable to get the input row metadata because of an error: 

What it means

Thrown by the getInputRowMeta helper function exposed to JavaScript scripts inside the Script transform (ScriptAddedFunctions.java). The script called getInputRowMeta(), and the wrapper failed to read the current input row metadata from the transform's ScriptDummy/step binding, wrapping the underlying exception in a RuntimeException with this message. It indicates the script environment could not supply the incoming row's row metadata (RowMetaInterface).

Solutions

  1. Inspect the wrapped cause printed after the message (Const.CR + e.toString()) and fix the underlying exception it reports.
  2. Ensure the script step has received/derived input row metadata before calling getInputRowMeta(); do not call it before any row flows through the step.
  3. Verify the bound step object is the expected transform type (ScriptInterface/ScriptDummy) and that the script is run by the intended Script transform variant, not a stripped-down one.
  4. If metadata is only needed for field names/types, replace getInputRowMeta() with explicit field access (e.g. row.getFieldNames equivalents) to avoid depending on step state.

Example fix

// before
var meta = getInputRowMeta();
var fields = meta.getFieldNames();
// after
if (metaAvailable()) { // e.g. only call after first row / in compatible step
  var meta = getInputRowMeta();
  var fields = meta.getFieldNames();
} else {
  var fields = []; // fallback
}
Defensive patterns

Strategy: try-catch

Validate before calling

// before relying on it, check the step binding exists
if (typeof getInputRowMeta !== 'function') throw new Error('getInputRowMeta not available in this step');

Type guard

function hasInputRowMeta() { try { return getInputRowMeta() != null; } catch (e) { return false; } }

Try / catch

try {
  var meta = getInputRowMeta();
} catch (e) {
  if (String(e).indexOf('Unable to get the input row metadata') !== -1) {
    // fall back to default metadata handling / log & continue
  } else { throw e; }
}

Prevention

When it happens

Trigger: A script (JavaScript/beanshell via the Script transform) invokes the added function getInputRowMeta() and either (a) the 'scm'/'_step_' bound object does not implement ScriptInterface so its getInputRowMeta() call throws, or (b) the fallback ScriptDummy.getInputRowMeta() throws an unexpected exception.

Common situations: Calling getInputRowMeta() in a script step running before the first row arrives (metadata not yet set), using the function in a Script transform variant where the step binding is a plain ScriptDummy without row metadata, or copy-pasting scripts written for one Pentaho/Kettle version into a differently-wired script step.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/33457b9a39fefa52. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:1893

      throw new RuntimeException( "The function call getOutputRowMeta doesn't require arguments." );
    }
  }

  // Return the input row metadata
  public static RowMetaInterface getInputRowMeta( ScriptEngine actualContext, Bindings actualObject,
    Object[] ArgList, Object FunctionContext ) {
    if ( ArgList.length == 0 ) {
      try {
        Object scmO = actualObject.get( "_step_" );
        try {
          Script scm = (Script) scmO;
          return scm.getInputRowMeta();
        } catch ( Exception e ) {
          ScriptDummy scm = (ScriptDummy) scmO;
          return scm.getInputRowMeta();
        }
      } catch ( Exception e ) {
        throw new RuntimeException( "Unable to get the input row metadata because of an error: "
          + Const.CR + e.toString() );
      }
    } else {
      throw new RuntimeException( "The function call getInputRowMeta doesn't require arguments." );
    }
  }

  // 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 );

View on GitHub (pinned to f3058517a1)