pentaho/pentaho-kettle · error · KettleValueException
ScriptValuesMod.Log.UnexpectedeError
Error message
ScriptValuesMod.Log.UnexpectedeError
What it means
Generic wrapper thrown when preparing the JavaScript scope for a row fails unexpectedly. Before executing the script, addValues() converts the incoming row values and the row metadata (rowMeta) into scriptable objects via Context.toObject and puts them into the scope; any Exception in that preparation is wrapped as a KettleValueException with the 'Unexpected error' message. The chained cause holds the real problem.
Solutions
- Inspect the chained cause to find which field or operation failed
- Check the row's field types upstream; convert exotic types (binary/serialized) to strings or numbers before this step
- Restart the transformation if the scripting Context became corrupted mid-run
- Ensure upstream steps define stable, well-typed fields for every row
- Update Kettle/Rhino to a version fixing scope-wrapping issues
Example fix
// before: passing raw binary field into script step // upstream Select Values passes TYPE_BINARY 'payload' // after: convert to string before the JavaScript step // (upstream) SelectValues metadata change: payload -> TYPE_STRING
Defensive patterns
Strategy: try-catch
Validate before calling
// Ensure upstream fields are simple, typed values before the script step // Preview the previous step and confirm no TYPE_BINARY / serialized fields reach the script
Try / catch
try {
processRow();
} catch ( KettleValueException e ) {
logError( "Row scope preparation failed for row: " + e.getCause(), e );
putError(...); // route the row to error handling instead of failing the transform
} Prevention
- Convert binary/complex fields to strings or numbers upstream
- Keep row metadata stable across transformation edits
- Enable step error handling to capture bad rows instead of aborting
When it happens
Trigger: Context.toObject(rowMeta, data.scope) or scope.put("rowMeta", ...) throws during row processing in addValues() from processRow — e.g. Rhino fails to wrap a value or the scope is in an invalid state.
Common situations: Rows containing exotic/binary field types that Rhino cannot wrap, corrupted row metadata after upstream type changes, or internal Context state problems in long-running transformations.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Error in isEmpty function:
- Script.Log.CouldNotAddDefaultConstants
- ScriptValuesMod.Log.CouldNotAddDefaultConstants
- ScriptValuesMod.Log.CouldNotCompileJavascript
- ScriptValuesMod.Log.ErrorProcessingStartScript
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/2754924cc07c9e5d.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesMod.java:377
Scriptable jsarg = Context.toObject( data.values_used[ i ], data.scope );
data.scope.put( valueMeta.getName(), data.scope, jsarg );
} else {
Object normalStorageValueData = valueMeta.convertToNormalStorageType( valueData );
Scriptable jsarg;
if ( normalStorageValueData != null ) {
jsarg = Context.toObject( normalStorageValueData, data.scope );
} else {
jsarg = null;
}
data.scope.put( valueMeta.getName(), data.scope, jsarg );
}
}
// also add the meta information for the hole row
Scriptable jsrowMeta = Context.toObject( rowMeta, data.scope );
data.scope.put( "rowMeta", data.scope, jsrowMeta );
} catch ( Exception e ) {
throw new KettleValueException( BaseMessages.getString( PKG, "ScriptValuesMod.Log.UnexpectedeError" ), e );
}
// Executing our Script
data.script.exec( data.cx, data.scope );
if ( bFirstRun ) {
bFirstRun = false;
// Check if we had a Transformation Status
Object tran_stat = data.scope.get( "trans_Status", data.scope );
if ( tran_stat != ScriptableObject.NOT_FOUND ) {
bWithTransStat = true;
if ( log.isDetailed() ) {
logDetailed( ( "tran_Status found. Checking transformation status while script execution." ) );
}
} else {
if ( log.isDetailed() ) {
logDetailed( ( "No tran_Status found. Transformation status checking not available." ) );
}View on GitHub (pinned to f3058517a1)