{"record":{"id":"d2bb4ebe994a3e2b","repo":"pentaho/pentaho-kettle","slug":"the-function-call-isnum-requires-1-argument","errorCode":null,"errorMessage":"The function call isNum requires 1 argument.","messagePattern":"The function call isNum requires 1 argument\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java","lineNumber":1454,"sourceCode":"\n    if ( ArgList.length == 1 ) {\n      try {\n        if ( isNull( ArgList[0] ) ) {\n          return null;\n        } else if ( isUndefined( ArgList[0] ) ) {\n          return undefinedValue;\n        }\n        double sArg1 = (Double) ArgList[0];\n        if ( Double.isNaN( sArg1 ) ) {\n          return Boolean.FALSE;\n        } else {\n          return Boolean.TRUE;\n        }\n      } catch ( Exception e ) {\n        return Boolean.FALSE;\n      }\n    } else {\n      throw new RuntimeException( \"The function call isNum requires 1 argument.\" );\n    }\n  }\n\n  public static Object isDate( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,\n    Object FunctionContext ) {\n\n    if ( ArgList.length == 1 ) {\n      try {\n        if ( isNull( ArgList[0] ) ) {\n          return null;\n        } else if ( isUndefined( ArgList[0] ) ) {\n          return undefinedValue;\n        }\n        /* java.util.Date d = (java.util.Date) */\n        return Boolean.TRUE;\n      } catch ( Exception e ) {\n        return Boolean.FALSE;\n      }","sourceCodeStart":1436,"sourceCodeEnd":1472,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java#L1436-L1472","documentation":"isNum is a JS-added function that checks whether its single argument can be evaluated as a number. If ArgList.length != 1 (zero arguments or more than one), it throws this RuntimeException instead of returning a boolean.","triggerScenarios":"Calling isNum() with no arguments, or isNum(a, b) with multiple arguments in a JavaScript transformation step.","commonSituations":"Passing several values hoping for a batch check, forgetting an argument, typo-ing a comma so two values are passed.","solutions":["Call isNum with exactly one argument; wrap multiple checks in separate calls.","Fix call sites that pass two values due to stray commas.","Combine checks manually: isNum(a) && isNum(b)."],"exampleFix":"// before\nvar ok = isNum(a, b); // throws\n// after\nvar ok = isNum(a) && isNum(b);","handlingStrategy":"validation","validationCode":"function safeIsNum(v) {\n  return (arguments.length === 1) ? isNum(v) : false;\n}","typeGuard":"function isNumLike(v) {\n  return typeof v === 'number' || (typeof v === 'string' && v.trim() !== '' && !isNaN(Number(v)));\n}","tryCatchPattern":"try {\n  var ok = isNum(v);\n} catch (e) {\n  // wrong arity: review the call site\n  var ok = false;\n}","preventionTips":["Always call isNum with exactly one argument.","Use a wrapper that enforces arity.","Check for stray commas in argument lists after edits."],"tags":["java","pdi","scripting","argument-count"],"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"}