pentaho/pentaho-kettle · error · KettleStepException
ScriptValuesMetaMod.Exception.NumberFormatException
Error message
ScriptValuesMetaMod.Exception.NumberFormatException
What it means
When no explicit Rhino optimization level is set, ScriptValuesMod falls back to parsing ScriptValuesMetaMod.OPTIMIZATION_LEVEL_DEFAULT with Integer.parseInt(); a NumberFormatException is caught and rethrown as a KettleStepException with the message ScriptValuesMetaMod.Exception.NumberFormatException. It means the configured (or substituted) optimization-level value is not a valid integer.
Solutions
- Open the step's Optimization level field and set a plain integer (typically -1 for interpreted mode or 0/9 for Rhino levels).
- If a Kettle variable is used, verify it is defined (kettle.properties / transformation parameter) and resolves to digits only at runtime.
- Trim the value: remove spaces, quotes, or trailing characters; enter exactly one integer token.
- Remove any units or comments from the field; the parser accepts only [-+]?digits.
Example fix
// before (step dialog / ktr XML)
<optimizationLevel>${JS_OPT_LEVEL}</optimizationLevel> <!-- variable undefined -> substitution empty -->
// after
<optimizationLevel>-1</optimizationLevel> <!-- or define JS_OPT_LEVEL=-1 in kettle.properties --> Defensive patterns
Strategy: validation
Validate before calling
// Java, validate the optimization level before building the step meta
String lvl = environmentSubstitute(meta.getOptimizationLevel());
if (lvl != null) {
try { Integer.parseInt(lvl.trim()); }
catch (NumberFormatException nfe) {
throw new IllegalArgumentException("Optimization level must be an integer, got: '" + lvl + "'");
}
} Try / catch
try {
transformation.execute(params);
} catch (KettleStepException e) {
if (e.getMessage().contains("NumberFormatException")) {
// fix the Optimization level field or the Kettle variable it references, retry
} else { throw e; }
} Prevention
- Enter only plain integers (-1, 0, 9) in the Optimization level field.
- If using a variable, define it in kettle.properties or as a parameter and confirm its value at runtime.
- Avoid whitespace, units, decimals, and comments in numeric config fields.
- Add a transformation-level parameter with a numeric default so the substitution is never empty.
When it happens
Trigger: environmentSubstitute(meta.getOptimizationLevel()) yields a string that Integer.parseInt() cannot parse — e.g. a variable like ${OPT_LEVEL} resolves to empty, non-numeric text, or contains whitespace/units, and the code attempts Integer.parseInt on the default/actual value inside addValues().
Common situations: Optimization level field left blank or containing a Kettle variable that is undefined at runtime (substitutes to empty or literal '${VAR}'); user typed '0.5' or '-1 fast' or a thousand-separated number; value comes from an environment variable set on a server with the wrong content.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- AddSequence.Exception.NoSpecifiedMethod
- BaseStep.Exception.SourceStepToReadFromCantRunInMultipleCopies
- BaseStep.Exception.TargetStepToWriteToCantRunInMultipleCopies
- BaseStep.Exception.SourceStepToReadFromDoesntExist
- BaseStep.Exception.TargetStepToWriteToDoesntExist
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/7a26f068b823ae8a.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesMod.java:186
}
}
// set the optimization level
data.cx = ContextFactory.getGlobal().enterContext();
try {
String optimizationLevelAsString = environmentSubstitute( meta.getOptimizationLevel() );
if ( !Utils.isEmpty( Const.trim( optimizationLevelAsString ) ) ) {
data.cx.setOptimizationLevel( Integer.parseInt( optimizationLevelAsString.trim() ) );
logBasic( BaseMessages.getString( PKG, "ScriptValuesMod.Optimization.Level", environmentSubstitute( meta
.getOptimizationLevel() ) ) );
} else {
data.cx.setOptimizationLevel( Integer.parseInt( ScriptValuesMetaMod.OPTIMIZATION_LEVEL_DEFAULT ) );
logBasic( BaseMessages.getString(
PKG, "ScriptValuesMod.Optimization.UsingDefault", ScriptValuesMetaMod.OPTIMIZATION_LEVEL_DEFAULT ) );
}
} catch ( NumberFormatException nfe ) {
throw new KettleStepException( BaseMessages.getString(
PKG, "ScriptValuesMetaMod.Exception.NumberFormatException", environmentSubstitute( meta
.getOptimizationLevel() ) ) );
} catch ( IllegalArgumentException iae ) {
throw new KettleException( iae.getMessage() );
}
data.scope = data.cx.initStandardObjects( null, false );
bFirstRun = true;
Scriptable jsvalue = Context.toObject( this, data.scope );
data.scope.put( "_step_", data.scope, jsvalue );
// Adding the existing Scripts to the Context
for ( int i = 0; i < meta.getNumberOfJSScripts(); i++ ) {
Scriptable jsR = Context.toObject( jsScripts[ i ].getScript(), data.scope );
data.scope.put( jsScripts[ i ].getScriptName(), data.scope, jsR );
}View on GitHub (pinned to f3058517a1)