{"record":{"id":"6040c251ab26b87e","repo":"pentaho/pentaho-kettle","slug":"the-function-call-unescapehtml-requires-1-argument","errorCode":null,"errorMessage":"The function call unEscapeHtml requires 1 argument.","messagePattern":"The function call unEscapeHtml requires 1 argument\\.","errorType":"exception","errorClass":"Rhino runtime error","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java","lineNumber":2731,"sourceCode":"\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.\" );\n\n    }\n  }\n\n  public static String escapeSQL( Context actualContext, Scriptable actualObject, Object[] ArgList,\n    Function FunctionContext ) {\n    if ( ArgList.length == 1 ) {\n      return Const.escapeSQL( Context.toString( ArgList[0] ) );\n    } else {","sourceCodeStart":2713,"sourceCodeEnd":2749,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java#L2713-L2749","documentation":"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.","triggerScenarios":"unEscapeHtml() with no argument, or with two or more arguments; the length==1 check fails and Context.reportRuntimeError fires.","commonSituations":"Users passing a target field name as a second argument expecting in-place assignment; empty expression after removing the argument variable.","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"],"exampleFix":"// before\nunEscapeHtml(htmlField, outputField);\n// after\noutputField = unEscapeHtml(htmlField);","handlingStrategy":"validation","validationCode":"if (typeof htmlField === 'string' && htmlField.length > 0) { outputField = unEscapeHtml(htmlField); }","typeGuard":"function isNonEmptyString(v){ return typeof v === 'string' && v.length > 0; }","tryCatchPattern":"try { outputField = unEscapeHtml(htmlField); } catch (e) { throw new Error('unEscapeHtml requires exactly 1 argument: ' + e.message); }","preventionTips":["Assign results to fields instead of passing output fields as arguments","Keep one argument per call","Review signature changes after Kettle upgrades"],"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"}