pentaho/pentaho-kettle · error · KettleValueException

ScriptValuesMod.Log.ErrorProcessingStartScript

Error message

ScriptValuesMod.Log.ErrorProcessingStartScript

What it means

Thrown when the optional Start Script configured in the Modified Java Script Value step fails during execution. addValues() runs strStartScript through the Rhino engine after the constants are registered; any Exception thrown by that startup script is wrapped in a KettleValueException with this message. The cause carries the actual script error.

Solutions

  1. Open the Start Script tab and fix the script error shown in the chained 'Caused by' stack trace
  2. Test the script logic in a minimal standalone script to reproduce the exception
  3. Remove or temporarily empty the Start Script to confirm it is the failing part
  4. Replace unsupported modern JS syntax with Rhino-compatible (ES5) code
  5. Move initialization logic that doesn't need to run first into the main transform script

Example fix

// before: start script using unsupported syntax
var cfg = { fields: ["a","b"] }; // arrow fns, let/const, etc. may fail on old Rhino
// after: ES5-compatible start script
var cfg = new Object();
cfg.fields = [ "a", "b" ];
Defensive patterns

Strategy: validation

Validate before calling

// Validate the start script parses before configuring the step (ES5-only)
function validateStartScript(src) {
  try { new Function(src); return true; } catch (e) { return false; }
}

Try / catch

try {
  processRow();
} catch ( KettleValueException e ) {
  if ( e.getMessage().contains( "ErrorProcessingStartScript" ) ) {
    logError( "Start script failed: " + e.getCause(), e );
  }
  throw e;
}

Prevention

When it happens

Trigger: The user entered a non-empty Start Script (strStartScript) in the step dialog and executing it with data.cx throws (syntax error, undefined variable, invalid API call) during addValues() called from processRow.

Common situations: Copy-pasted start script with typos, referencing fields/functions not yet defined, using Rhino-unsupported ES6 syntax, or calling transformation APIs with wrong arguments in the Start Script tab.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesMod.java:307

            PKG, "ScriptValuesMod.Log.CouldNotAddDefaultConstants" ), ex );
        }

        try {
          // Checking for StartScript
          if ( strStartScript != null && strStartScript.length() > 0 ) {
            Script startScript = data.cx.compileString( strStartScript, "trans_Start", 1, null );
            startScript.exec( data.cx, data.scope );
            if ( log.isDetailed() ) {
              logDetailed( ( "Start Script found!" ) );
            }
          } else {
            if ( log.isDetailed() ) {
              logDetailed( ( "No starting Script found!" ) );
            }
          }
        } catch ( Exception es ) {
          // System.out.println("Exception processing StartScript " + es.toString());
          throw new KettleValueException( BaseMessages.getString(
            PKG, "ScriptValuesMod.Log.ErrorProcessingStartScript" ), es );

        }
        // Now Compile our Script
        data.script = data.cx.compileString( strTransformScript, "script", 1, null );
      } catch ( Exception e ) {
        throw new KettleValueException( BaseMessages.getString(
          PKG, "ScriptValuesMod.Log.CouldNotCompileJavascript" ), e );
      }
    }

    // Filling the defined TranVars with the Values from the Row
    //
    Object[] outputRow = RowDataUtil.resizeArray( row, data.outputRowMeta.size() );

    // Keep an index...
    int outputIndex = rowMeta.size();

View on GitHub (pinned to f3058517a1)