pentaho/pentaho-kettle · error · pentaho.lang.ArgumentRequiredError

Argument 'args' is required.

Error message

Argument 'args' is required.

What it means

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.

Solutions

  1. Pass the real arguments object: arg.slice(arguments, 1).
  2. Default to an empty array when the source may be missing: arg.slice(args || [], 0).
  3. If converting to modern JS, use rest parameters instead: function f(...args).

Example fix

// before
function wrap() { return arg.slice(forwarded, 1); } // forwarded is undefined
// after
function wrap() { return arg.slice(arguments, 1); }
Defensive patterns

Strategy: validation

Validate before calling

if (!args) args = [];
var rest = arg.slice(args, start, end);

Type guard

function isArgsLike(x) { return x != null && typeof x.length === 'number'; }

Try / catch

try { return arg.slice(args, 1); } catch (e) { if (/Argument 'args' is required/.test(e.message)) { return []; } throw e; }

Prevention

When it happens

Trigger: Calling arg.slice(null), arg.slice(undefined), or arg.slice() from a helper that did not capture its own `arguments` object.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/9e05ea78627cb9ea. Report an issue: GitHub.

Appendix: source

Thrown at plugins/core-ui/src/main/resources/app/pentaho/util/arg.js:93

      if(o && (v = o[p]) != null) {
        return v;
      }

      throw new ArgumentRequiredError((pscope ? (pscope + ".") : "") + p);
    },

    /**
     * Slices the provided array.
     *
     * @param {object} args Array of anything.
     * @param {number} [start=0] The index of the `args` array to begin the slice.
     * @param {number} [end] The index of the `args` array to end the slice at.
     *
     * @return {Array} Array containing the elements from the `args` array between the `start` and the `end`.
     */
    slice: function(args, start, end) {
      if(!args) {
        throw new ArgumentRequiredError("args");
      }

      /* eslint default-case: 0 */
      switch(arguments.length) {
        case 1: return A_slice.call(args);
        case 2: return A_slice.call(args, start);
      }

      return A_slice.call(args, start, end);
    }
  };
});

View on GitHub (pinned to f3058517a1)