pentaho/pentaho-kettle · error · Rhino runtime error
The function call unEscapeHtml requires 1 argument.
Error message
The function call unEscapeHtml requires 1 argument.
What it means
unEscapeHtml converts HTML entities back to characters via Const.unEscapeHtml in the Modified Java Script Value step. The wrapper throws this Rhino runtime error whenever the function is called with anything other than exactly one argument.
Solutions
- Call unEscapeHtml with exactly one string argument: unEscapeHtml(field)
- Assign the result to a field rather than passing it as a second argument
- Test the script with a single sample row before running the transformation
Example fix
// before unEscapeHtml(htmlField, outputField); // after outputField = unEscapeHtml(htmlField);
Defensive patterns
Strategy: validation
Validate before calling
if (typeof htmlField === 'string' && htmlField.length > 0) { outputField = unEscapeHtml(htmlField); } Type guard
function isNonEmptyString(v){ return typeof v === 'string' && v.length > 0; } Try / catch
try { outputField = unEscapeHtml(htmlField); } catch (e) { throw new Error('unEscapeHtml requires exactly 1 argument: ' + e.message); } Prevention
- Assign results to fields instead of passing output fields as arguments
- Keep one argument per call
- Review signature changes after Kettle upgrades
When it happens
Trigger: unEscapeHtml() with no argument, or with two or more arguments; the length==1 check fails and Context.reportRuntimeError fires.
Common situations: Users passing a target field name as a second argument expecting in-place assignment; empty expression after removing the argument variable.
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
- The function call escapeHtml requires 1 argument.
- The function call date2str requires 1, 2, 3, or 4 arguments.
- The function call dateAdd requires 3 arguments.
- The function call escapeSQL requires 1 argument.
- The function call escapeXml requires 1 argument.
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/6040c251ab26b87e.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:2731
}
}
public static String escapeHtml( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function FunctionContext ) {
if ( ArgList.length == 1 ) {
return Const.escapeHtml( Context.toString( ArgList[0] ) );
} else {
throw Context.reportRuntimeError( "The function call escapeHtml requires 1 argument." );
}
}
public static String unEscapeHtml( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function FunctionContext ) {
if ( ArgList.length == 1 ) {
return Const.unEscapeHtml( Context.toString( ArgList[0] ) );
} else {
throw Context.reportRuntimeError( "The function call unEscapeHtml requires 1 argument." );
}
}
public static String unEscapeXml( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function FunctionContext ) {
if ( ArgList.length == 1 ) {
return Const.unEscapeXml( Context.toString( ArgList[0] ) );
} else {
throw Context.reportRuntimeError( "The function call unEscapeXml requires 1 argument." );
}
}
public static String escapeSQL( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function FunctionContext ) {
if ( ArgList.length == 1 ) {
return Const.escapeSQL( Context.toString( ArgList[0] ) );
} else {View on GitHub (pinned to f3058517a1)