pentaho/pentaho-kettle · error · Rhino runtime error
The function call unEscapeXml requires 1 argument.
Error message
The function call unEscapeXml requires 1 argument.
What it means
unEscapeXml reverses XML escaping via Const.unEscapeXml in the Modified Java Script Value step. This error is thrown when the function is invoked with an argument count other than exactly 1, because the wrapper requires a single string input.
Solutions
- Call unEscapeXml with exactly one argument: unEscapeXml(xmlString)
- Drop any extra parameters (encoding, flags are unsupported)
- Check the function reference in the Modified Java Script Value step
Example fix
// before var raw = unEscapeXml(xml, "UTF-8"); // after var raw = unEscapeXml(xml);
Defensive patterns
Strategy: validation
Validate before calling
if (typeof xml === 'string') { var raw = unEscapeXml(xml); } Type guard
function isString(v){ return typeof v === 'string'; } Try / catch
try { var raw = unEscapeXml(xml); } catch (e) { throw new Error('unEscapeXml requires exactly 1 argument: ' + e.message); } Prevention
- Do not pass encoding or flag parameters
- Confirm argument count in the step dialog
- Test scripts on a single row first
When it happens
Trigger: unEscapeXml() with zero arguments or unEscapeXml(a, b) with extra arguments; ArgList.length != 1 reaches the else branch and throws.
Common situations: Scripts migrated from other engines whose unEscapeXml takes a second flag; users attempting to pass an encoding name as a second parameter.
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 escapeXml requires 1 argument.
- The function call date2str requires 1, 2, 3, or 4 arguments.
- The function call dateAdd requires 3 arguments.
- The function call escapeHtml requires 1 argument.
- The function call escapeSQL requires 1 argument.
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/3a70b605a423c2e3.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:2740
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 {
throw Context.reportRuntimeError( "The function call escapeSQL requires 1 argument." );
}
}
public static String protectXMLCDATA( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function FunctionContext ) {
if ( ArgList.length == 1 ) {
return Const.protectXMLCDATA( Context.toString( ArgList[0] ) );View on GitHub (pinned to f3058517a1)