{"record":{"id":"019727fe0282e086","repo":"pentaho/pentaho-kettle","slug":"argument-formodule-is-required","errorCode":null,"errorMessage":"Argument 'forModule' is required.","messagePattern":"Argument 'forModule' is required\\.","errorType":"validation","errorClass":"pentaho.lang.ArgumentRequiredError","httpStatus":null,"severity":"error","filePath":"plugins/core-ui/src/main/resources/app/pentaho/module/Annotation.js","lineNumber":69,"sourceCode":"     * Annotations are immutable.\n     *\n     * @alias Annotation\n     * @memberOf pentaho.module\n     * @class\n     * @abstract\n     *\n     * @description Creates an annotation associated with a given module.\n     * @constructor\n     * @param {pentaho.module.IMeta} forModule - The annotated module.\n     *\n     * @see pentaho.module.IMeta#hasAnnotation\n     * @see pentaho.module.IMeta#getAnnotationsIds\n     * @see pentaho.module.IMeta#getAnnotation\n     * @see pentaho.module.IMeta#getAnnotationAsync\n     */\n    constructor: function(forModule) {\n      if(forModule == null) {\n        throw new ArgumentRequiredError(\"forModule\");\n      }\n\n      this.__forModule = forModule;\n    },\n\n    /**\n     * Gets the annotated module.\n     *\n     * @type {pentaho.module.IMeta}\n     * @readOnly\n     */\n    get forModule() {\n      return this.__forModule;\n    }\n  }, /** @lends pentaho.module.Annotation */{\n    /**\n     * Gets the type of annotation.\n     *","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core-ui/src/main/resources/app/pentaho/module/Annotation.js#L51-L87","documentation":"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.","triggerScenarios":"Calling `new pentaho.module.Annotation()` or `new Annotation(null)` instead of passing an IMeta/IModuleMeta instance obtained from the module system.","commonSituations":"Constructing annotations manually before the module metadata is available; typos in variable names passing undefined; creating annotations in unit tests without a module fixture.","solutions":["Pass the module metadata object: new Annotation(moduleMeta).","Obtain the module via the module system (e.g. context.modules.get(id)) before constructing the annotation.","Guard the value with a null check or use pentaho.util.arg.required before calling the constructor."],"exampleFix":"// before\nvar ann = new Annotation();\n// after\nvar ann = new Annotation(moduleMeta);","handlingStrategy":"validation","validationCode":"if (forModule == null) throw new Error('Cannot create Annotation without a module');","typeGuard":"function isModuleMeta(x) { return x != null && typeof x.getAnnotation === 'function'; }","tryCatchPattern":"try { return new Annotation(forModule); } catch (e) { if (/forModule/.test(e.message)) { /* resolve module first */ } throw e; }","preventionTips":["Resolve the module metadata via the module system before constructing annotations.","Use arg.required(forModule, 'forModule') at helper entry points.","In tests, build a module fixture in beforeEach so it is never undefined."],"tags":["argument-required","module-system","annotation"],"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"}