pentaho/pentaho-kettle · error · KettleFileException

Row.ErrorReadingRowData

Error message

Row.ErrorReadingRowData

What it means

The trim scripting function wraps any exception raised while trimming (string conversion or Const.trim) into a Rhino runtime error prefixed with 'The function call trim is not valid : '. The thrown message concatenates e.getMessage(), so the trailing colon in the fixed prefix is followed by the underlying cause text. It fires only when the argument count is already correct (1) but processing fails.

Solutions

  1. Coerce the argument to a string yourself before trimming: trim(String(x)).
  2. Guard against null/undefined: if (x == null) x = ''; before calling trim.
  3. Read the text after the colon in the thrown message to identify the underlying conversion failure.
  4. Use native JavaScript x.trim() ( Rhino 1.7+ supports it) instead of the Kettle trim function.

Example fix

// before
trim(someJavaObject);
// after
var s = (someJavaObject == null) ? "" : String(someJavaObject);
trim(s);
Defensive patterns

Strategy: type-guard

Validate before calling

if (x == null) x = "";
if (typeof x === "object") x = String(x);

Type guard

function isStringable(x) { return x != null && typeof x !== "undefined"; }

Try / catch

var t;
try {
  t = trim(String(x));
} catch (e) {
  t = String(x == null ? "" : x).replace(/^\s+|\s+$/g, "");
}

Prevention

When it happens

Trigger: Calling trim(x) with exactly one argument whose Context.toString() conversion throws, or a non-convertible Scriptable/Java object, or an internal error in Const.trim.

Common situations: Passing a Java object reference or host object that cannot be coerced to a JavaScript string; passing null wrapped values from a previous step; Rhino conversion quirks with undefined-but-not-undefined wrappers.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/compatibility/Row.java:489

      Value v = new Value();
      v.readObj( dis );
      addValue( v );
    }
  }

  /**
   * Read a row of Values from an input-stream.
   *
   * @param dis
   *          The DataInputStream to read from
   */
  public Row( DataInputStream dis ) throws KettleFileException {
    try {
      readObj( dis );
    } catch ( EOFException e ) {
      throw new KettleEOFException( BaseMessages.getString( PKG, "Row.EndOfFileReached" ), e );
    } catch ( Exception e ) {
      throw new KettleFileException( BaseMessages.getString( PKG, "Row.ErrorReadingRowData" ), e );
    }
  }

  /**
   * Read a number of Values without meta-data into a row.
   *
   * @param dis
   *          The DataInputStream to read from
   * @param meta
   *          The description (name, type, length, precision) of the values to be read (the same number of values are
   *          read)
   * @throws KettleFileException
   *           if the row couldn't be created by reading from the data input stream.
   */
  public Row( DataInputStream dis, Row meta ) throws KettleFileException {
    this( dis, meta.size(), meta );
  }

View on GitHub (pinned to f3058517a1)