{"record":{"id":"9e05ea78627cb9ea","repo":"pentaho/pentaho-kettle","slug":"argument-args-is-required","errorCode":null,"errorMessage":"Argument 'args' is required.","messagePattern":"Argument 'args' is required\\.","errorType":"validation","errorClass":"pentaho.lang.ArgumentRequiredError","httpStatus":null,"severity":"error","filePath":"plugins/core-ui/src/main/resources/app/pentaho/util/arg.js","lineNumber":93,"sourceCode":"      if(o && (v = o[p]) != null) {\n        return v;\n      }\n\n      throw new ArgumentRequiredError((pscope ? (pscope + \".\") : \"\") + p);\n    },\n\n    /**\n     * Slices the provided array.\n     *\n     * @param {object} args Array of anything.\n     * @param {number} [start=0] The index of the `args` array to begin the slice.\n     * @param {number} [end] The index of the `args` array to end the slice at.\n     *\n     * @return {Array} Array containing the elements from the `args` array between the `start` and the `end`.\n     */\n    slice: function(args, start, end) {\n      if(!args) {\n        throw new ArgumentRequiredError(\"args\");\n      }\n\n      /* eslint default-case: 0 */\n      switch(arguments.length) {\n        case 1: return A_slice.call(args);\n        case 2: return A_slice.call(args, start);\n      }\n\n      return A_slice.call(args, start, end);\n    }\n  };\n});\n","sourceCodeStart":75,"sourceCodeEnd":106,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core-ui/src/main/resources/app/pentaho/util/arg.js#L75-L106","documentation":"pentaho.util.arg.slice(args, start, end) slices an arguments-like array but refuses falsy inputs, throwing ArgumentRequiredError('args'). It exists to guard argument-forwarding helpers against being called with no arguments object.","triggerScenarios":"Calling arg.slice(null), arg.slice(undefined), or arg.slice() from a helper that did not capture its own `arguments` object.","commonSituations":"Variadic wrapper functions that forget to forward `arguments` to the slicing utility; refactors that change function signatures from using `arguments` to named params but keep the slice call.","solutions":["Pass the real arguments object: arg.slice(arguments, 1).","Default to an empty array when the source may be missing: arg.slice(args || [], 0).","If converting to modern JS, use rest parameters instead: function f(...args)."],"exampleFix":"// before\nfunction wrap() { return arg.slice(forwarded, 1); } // forwarded is undefined\n// after\nfunction wrap() { return arg.slice(arguments, 1); }","handlingStrategy":"validation","validationCode":"if (!args) args = [];\nvar rest = arg.slice(args, start, end);","typeGuard":"function isArgsLike(x) { return x != null && typeof x.length === 'number'; }","tryCatchPattern":"try { return arg.slice(args, 1); } catch (e) { if (/Argument 'args' is required/.test(e.message)) { return []; } throw e; }","preventionTips":["Always forward the real `arguments` object to arg.slice.","Prefer rest parameters (...args) in new code to avoid arguments-object pitfalls.","Default missing argument sources to an empty array before slicing."],"tags":["argument-required","arguments-object","utility"],"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"}