{"record":{"id":"c203d00c9f646484","repo":"pentaho/pentaho-kettle","slug":"the-function-call-escapehtml-requires-1-argument","errorCode":null,"errorMessage":"The function call escapeHtml requires 1 argument.","messagePattern":"The function call escapeHtml requires 1 argument\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java","lineNumber":2722,"sourceCode":"    }\n  }\n\n  public static String escapeXml( Context actualContext, Scriptable actualObject, Object[] ArgList,\n    Function FunctionContext ) {\n    if ( ArgList.length == 1 ) {\n      return Const.escapeXML( Context.toString( ArgList[0] ) );\n    } else {\n      throw Context.reportRuntimeError( \"The function call escapeXml requires 1 argument.\" );\n\n    }\n  }\n\n  public static String escapeHtml( Context actualContext, Scriptable actualObject, Object[] ArgList,\n    Function FunctionContext ) {\n    if ( ArgList.length == 1 ) {\n      return Const.escapeHtml( Context.toString( ArgList[0] ) );\n    } else {\n      throw Context.reportRuntimeError( \"The function call escapeHtml requires 1 argument.\" );\n    }\n  }\n\n  public static String unEscapeHtml( Context actualContext, Scriptable actualObject, Object[] ArgList,\n    Function FunctionContext ) {\n    if ( ArgList.length == 1 ) {\n      return Const.unEscapeHtml( Context.toString( ArgList[0] ) );\n    } else {\n      throw Context.reportRuntimeError( \"The function call unEscapeHtml requires 1 argument.\" );\n    }\n  }\n\n  public static String unEscapeXml( Context actualContext, Scriptable actualObject, Object[] ArgList,\n    Function FunctionContext ) {\n    if ( ArgList.length == 1 ) {\n      return Const.unEscapeXml( Context.toString( ArgList[0] ) );\n    } else {\n      throw Context.reportRuntimeError( \"The function call unEscapeXml requires 1 argument.\" );","sourceCodeStart":2704,"sourceCodeEnd":2740,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java#L2704-L2740","documentation":"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.","triggerScenarios":"escapeHtml() with zero args or escapeHtml(s, mode) with extra args; ArgList.length != 1 triggers Context.reportRuntimeError.","commonSituations":"Scripts ported from other JS environments where escapeHtml accepts options objects; users trying to pass an output field as a second argument.","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"],"exampleFix":"// before\nvar escaped = escapeHtml(text, false);\n// after\nvar escaped = escapeHtml(text);","handlingStrategy":"validation","validationCode":"if (typeof html === 'string') { var escaped = escapeHtml(html); }","typeGuard":"function isString(v){ return typeof v === 'string'; }","tryCatchPattern":"try { var escaped = escapeHtml(html); } catch (e) { throw new Error('escapeHtml requires exactly 1 argument: ' + e.message); }","preventionTips":["Call with exactly one argument","Do not port signatures from other JS libraries blindly","Test with sample rows before full execution"],"tags":["javascript","html","argument-count","pentaho-kettle"],"backgroundTag":"missing-required-argument","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}