pentaho/pentaho-kettle · error · Error

Argument 'id' is required.

Error message

Argument 'id' is required.

What it means

This AMD-style module loader shim's `define` function requires a module id as its first argument. Anonymous modules are not supported by this Pentaho loader implementation, and ArgumentRequiredError cannot be used here because Base.js itself depends on this module (cycle prevention). It throws a plain Error whenever the id argument is missing or not a string.

Solutions

  1. Add a string module id as the first argument to define()
  2. If the module comes from a bundle, re-run the optimizer (r.js) so each define gets an explicit id
  3. Wrap anonymous define calls with a named define shim assigning a module path

Example fix

// before
define(['pentaho/util/Base'], function(Base) { ... });
// after
define('my/plugin/MyModule', ['pentaho/util/Base'], function(Base) { ... });
Defensive patterns

Strategy: validation

Validate before calling

if (typeof id !== "string" || id.length === 0) throw new Error("define() requires a non-empty string module id");

Type guard

function hasModuleId(args) { return args.length > 0 && typeof args[0] === "string" && args[0].length > 0; }

Prevention

When it happens

Trigger: Calling `define()` with no arguments, `define(null)`, `define(function(){...})` (anonymous module), or `define(123, ...)` with a non-string id.

Common situations: Porting third-party AMD modules that rely on anonymous defines (bundlers like r.js usually generate ids); hand-written modules omitting the id; refactoring that dropped a string literal id.

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/c820c04d793d0557. Report an issue: GitHub.

Appendix: source

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

   * @private
   */
  var requireJS = /** @lends pentaho.util.requireJS */{
    /**
     * Defines a module in the current RequireJS context.
     *
     * @param {string} id The module id.
     * @param {string[]} [deps] The ids of dependencies.
     * @param {function|*} callback The module definition function or the module's value.
     *
     * @return {pentaho.util.require} This utility.
     */
    define: function(id, deps, callback) {

      if(!id || typeof id !== "string") {
        // Anonymous modules not supported.
        // Cannot use ArgumentRequiredError, or a cycle would occur, as it is based in Base.js and
        // the latter uses this.
        throw new Error("Argument 'id' is required.");
      }

      // This module may not have dependencies
      if(!Array.isArray(deps)) {
        callback = deps;
        deps = null;
      }

      if(!deps && typeof callback === "function") {
        deps = [];
      }

      // Publish module in this context's queue.
      // A require call will process these first.
      context.defQueue.push([id, deps, callback]);
      context.defQueueMap[id] = true;

      return requireJS;

View on GitHub (pinned to f3058517a1)