pentaho/pentaho-kettle · error
The function call escapeHtml requires 1 argument.
Error message
The function call escapeHtml requires 1 argument.
What it means
escapeHtml HTML-escapes a string using Const.escapeHtml in the Modified Java Script Value step. This error is thrown when the function is invoked with an argument count other than 1 — the wrapper only supports a single input string.
Solutions
- Call escapeHtml with exactly one argument: escapeHtml(htmlString)
- Remove extra arguments; escaping options are not supported by this built-in
- Review the JS function list in the step dialog for the correct signature
Example fix
// before var escaped = escapeHtml(text, false); // after var escaped = escapeHtml(text);
Defensive patterns
Strategy: validation
Validate before calling
if (typeof html === 'string') { var escaped = escapeHtml(html); } Type guard
function isString(v){ return typeof v === 'string'; } Try / catch
try { var escaped = escapeHtml(html); } catch (e) { throw new Error('escapeHtml requires exactly 1 argument: ' + e.message); } Prevention
- Call with exactly one argument
- Do not port signatures from other JS libraries blindly
- Test with sample rows before full execution
When it happens
Trigger: escapeHtml() with zero args or escapeHtml(s, mode) with extra args; ArgList.length != 1 triggers Context.reportRuntimeError.
Common situations: Scripts ported from other JS environments where escapeHtml accepts options objects; users trying to pass an output field as a second argument.
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 unEscapeHtml 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/c203d00c9f646484.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:2722
}
}
public static String escapeXml( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function FunctionContext ) {
if ( ArgList.length == 1 ) {
return Const.escapeXML( Context.toString( ArgList[0] ) );
} else {
throw Context.reportRuntimeError( "The function call escapeXml requires 1 argument." );
}
}
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." );View on GitHub (pinned to f3058517a1)