pentaho/pentaho-kettle · error · KettleEOFException

Row.EndOfFileReadingRow

Error message

Row.EndOfFileReadingRow

What it means

trim requires exactly 1 argument. This is a pure argument-count guard at ScriptValuesAddedFunctions.java:1650: when ArgList.length != 1 the function throws this Rhino runtime error. Unlike the 'not valid' variant, no processing was attempted - the call signature itself is wrong.

Solutions

  1. Call trim with exactly one argument: trim(str).
  2. For trimming specific characters, implement it in JavaScript (replace/regex) rather than passing extra arguments.
  3. Check the call site for stray commas that introduce extra arguments.

Example fix

// before
var t = trim(str, " ");
// after
var t = trim(str);
Defensive patterns

Strategy: validation

Validate before calling

if (arguments.length !== 1) throw new Error("trim takes exactly one argument");

Type guard

null

Try / catch

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

Prevention

When it happens

Trigger: Calling trim() with zero arguments, or trim(a, b) with multiple arguments, from JavaScript in the Script Values step.

Common situations: Assuming Java-style trim with character-set arguments like trim(str, 'x'); accidentally leaving a second argument from a chained expression; calling with an empty argument list after a variable rename.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

   * Read a number of Values without meta-data into a row.
   *
   * @param dis
   *          The DataInputStream to read from
   * @param size
   *          the number or values to read
   * @param meta
   *          The description (name, type, length, precision) of the values to be read
   * @throws KettleFileException
   *           if the row couldn't be created by reading from the data input stream.
   */
  public Row( DataInputStream dis, int size, Row meta ) throws KettleFileException {
    try {
      // get all values in the row
      for ( int i = 0; i < size; i++ ) {
        addValue( new Value( meta.getValue( i ), dis ) );
      }
    } catch ( KettleEOFException e ) {
      throw new KettleEOFException( BaseMessages.getString( PKG, "Row.EndOfFileReadingRow" ), e );
    } catch ( Exception e ) {
      throw new KettleFileException( BaseMessages.getString( PKG, "Row.RowError" ), e );
    }
  }

  /**
   * Write a row of Values to a DataOutputStream, without saving the meta-data.
   *
   * @param dos
   *          The DataOutputStream to write to
   * @return true if the row was written successfuly, false if something went wrong.
   */
  public boolean writeData( DataOutputStream dos ) throws KettleFileException {
    // get all values in the row
    for ( int i = 0; i < size(); i++ ) {
      Value v = getValue( i );
      v.writeData( dos );
    }

View on GitHub (pinned to f3058517a1)