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

Argument 'forModule' is required.

Error message

Argument 'forModule' is required.

What it means

The pentaho.module.Annotation constructor requires the module the annotation is attached to (`forModule`). If it is null or undefined, it throws ArgumentRequiredError('forModule'). An annotation only makes sense relative to a concrete module instance of the module system.

Solutions

  1. Pass the module metadata object: new Annotation(moduleMeta).
  2. Obtain the module via the module system (e.g. context.modules.get(id)) before constructing the annotation.
  3. Guard the value with a null check or use pentaho.util.arg.required before calling the constructor.

Example fix

// before
var ann = new Annotation();
// after
var ann = new Annotation(moduleMeta);
Defensive patterns

Strategy: validation

Validate before calling

if (forModule == null) throw new Error('Cannot create Annotation without a module');

Type guard

function isModuleMeta(x) { return x != null && typeof x.getAnnotation === 'function'; }

Try / catch

try { return new Annotation(forModule); } catch (e) { if (/forModule/.test(e.message)) { /* resolve module first */ } throw e; }

Prevention

When it happens

Trigger: Calling `new pentaho.module.Annotation()` or `new Annotation(null)` instead of passing an IMeta/IModuleMeta instance obtained from the module system.

Common situations: Constructing annotations manually before the module metadata is available; typos in variable names passing undefined; creating annotations in unit tests without a module fixture.

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

Appendix: source

Thrown at plugins/core-ui/src/main/resources/app/pentaho/module/Annotation.js:69

     * Annotations are immutable.
     *
     * @alias Annotation
     * @memberOf pentaho.module
     * @class
     * @abstract
     *
     * @description Creates an annotation associated with a given module.
     * @constructor
     * @param {pentaho.module.IMeta} forModule - The annotated module.
     *
     * @see pentaho.module.IMeta#hasAnnotation
     * @see pentaho.module.IMeta#getAnnotationsIds
     * @see pentaho.module.IMeta#getAnnotation
     * @see pentaho.module.IMeta#getAnnotationAsync
     */
    constructor: function(forModule) {
      if(forModule == null) {
        throw new ArgumentRequiredError("forModule");
      }

      this.__forModule = forModule;
    },

    /**
     * Gets the annotated module.
     *
     * @type {pentaho.module.IMeta}
     * @readOnly
     */
    get forModule() {
      return this.__forModule;
    }
  }, /** @lends pentaho.module.Annotation */{
    /**
     * Gets the type of annotation.
     *

View on GitHub (pinned to f3058517a1)