pentaho/pentaho-kettle · error · KettleValueException

Script.Log.ErrorProcessingStartScript

Script.Log.ErrorProcessingStartScript

Error message

Script.Log.ErrorProcessingStartScript

What it means

Thrown in Script.addValues when execution of the configured Start Script fails. The step runs an optional start script once before the main transform script; any Exception raised while processing it is wrapped in a KettleValueException with this message. The cause is in the wrapped exception (es).

Solutions

  1. Open the Start Script tab and fix the JavaScript syntax/runtime error reported in the wrapped cause.
  2. Temporarily clear the Start Script to confirm the failure originates there.
  3. Move start-script logic into the main script guarded by an if(first) block as an equivalent alternative.
  4. Validate the script in the step's Test script button before running the transformation.

Example fix

// before (Start Script)
var x = ;
// after
var x = 0;
Defensive patterns

Strategy: try-catch

Validate before calling

// smoke-test the start script before the run
String js = meta.getStartScript();
if (js != null && js.length() > 0) {
  // evaluate with the step's 'Test script' button or a JS parser
  new javax.script.ScriptEngineManager().getEngineByName("ECMAScript").eval(js);
}

Try / catch

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

Prevention

When it happens

Trigger: addValues (called from processRow) finding a non-empty Start Script (strStartScript) and evaluating it; the eval throws any Exception (syntax error, runtime error, missing function, disallowed operation).

Common situations: Syntax errors in the Start Script; calling functions not defined at start time; scripts copied from a Rhino-based step that use unsupported constructs under the JSR-223 engine; defining things the main script expects but with errors in the start script itself.

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/7bf76293931379b6. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/Script.java:267

        }

        try {
          // Checking for StartScript
          if ( strStartScript != null && strStartScript.length() > 0 ) {
            CompiledScript startScript = ( (Compilable) data.cx ).compile( strStartScript );
            startScript.eval( 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, "Script.Log.ErrorProcessingStartScript" ), es );

        }
        // Now Compile our Script
        // alternatively you could also support non compilable JSR223
        // languages, see how we were doing before:
        // http://github.com/rvalyi/jripple/blob/e6190fd89014a49b0faffae68c75762be124d899/
        // src/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesMod.java

        data.script = ( (Compilable) data.cx ).compile( strTransformScript );
      } catch ( Exception e ) {
        throw new KettleValueException( BaseMessages.getString( PKG, "Script.Log.CouldNotCompileJavascript" ), e );
      }
    }

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

View on GitHub (pinned to f3058517a1)