{"record":{"id":"97b07bb0259f59f8","repo":"pentaho/pentaho-kettle","slug":"the-function-call-resolveip-requires-2-arguments-97b07b","errorCode":null,"errorMessage":"The function call resolveIP requires 2 arguments.","messagePattern":"The function call resolveIP requires 2 arguments\\.","errorType":"exception","errorClass":"RhinoRuntimeError","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java","lineNumber":1727,"sourceCode":"  public static String resolveIP( Context actualContext, Scriptable actualObject, Object[] ArgList,\n    Function FunctionContext ) {\n    String sRC;\n    if ( ArgList.length == 2 ) {\n      try {\n        InetAddress address = InetAddress.getByName( Context.toString( ArgList[0] ) );\n        if ( Context.toString( ArgList[1] ).equals( \"IP\" ) ) {\n          sRC = address.getHostName();\n        } else {\n          sRC = address.getHostAddress();\n        }\n        if ( sRC.equals( Context.toString( ArgList[0] ) ) ) {\n          sRC = \"-\";\n        }\n      } catch ( Exception e ) {\n        sRC = \"-\";\n      }\n    } else {\n      throw Context.reportRuntimeError( \"The function call resolveIP requires 2 arguments.\" );\n    }\n\n    return sRC;\n  }\n\n  // Loading additional JS Files inside the JavaScriptCode\n  public static void LoadScriptFile( Context actualContext, Scriptable actualObject, Object[] ArgList,\n    Function FunctionContext ) {\n    for ( int i = 0; i < ArgList.length; i++ ) { // don't worry about \"undefined\" arguments\n      checkAndLoadJSFile( actualContext, actualObject, Context.toString( ArgList[i] ) );\n    }\n  }\n\n  // Adding the ScriptsItemTab to the actual running Context\n  public static void LoadScriptFromTab( Context actualContext, Scriptable actualObject, Object[] ArgList,\n    Function FunctionContext ) {\n    try {\n      for ( int i = 0; i < ArgList.length; i++ ) { // don't worry about \"undefined\" arguments","sourceCodeStart":1709,"sourceCodeEnd":1745,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java#L1709-L1745","documentation":"Arity guard for resolveIP: the function takes exactly two arguments (hostname/IP and a flag where \"IP\" yields the hostname and anything else the address). Network failures themselves are swallowed and return \"-\"; only a wrong argument count throws.","triggerScenarios":"Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:1727 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call resolveIP(host, \"IP\") or resolveIP(host, \"host\") with exactly two arguments","Check the result for \"-\" to detect resolution failure"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}