{"record":{"id":"c820c04d793d0557","repo":"pentaho/pentaho-kettle","slug":"argument-id-is-required-requirejs","errorCode":null,"errorMessage":"Argument 'id' is required.","messagePattern":"Argument 'id' is required\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"plugins/core-ui/src/main/resources/app/pentaho/util/requireJS.js","lineNumber":48,"sourceCode":"   * @private\n   */\n  var requireJS = /** @lends pentaho.util.requireJS */{\n    /**\n     * Defines a module in the current RequireJS context.\n     *\n     * @param {string} id The module id.\n     * @param {string[]} [deps] The ids of dependencies.\n     * @param {function|*} callback The module definition function or the module's value.\n     *\n     * @return {pentaho.util.require} This utility.\n     */\n    define: function(id, deps, callback) {\n\n      if(!id || typeof id !== \"string\") {\n        // Anonymous modules not supported.\n        // Cannot use ArgumentRequiredError, or a cycle would occur, as it is based in Base.js and\n        // the latter uses this.\n        throw new Error(\"Argument 'id' is required.\");\n      }\n\n      // This module may not have dependencies\n      if(!Array.isArray(deps)) {\n        callback = deps;\n        deps = null;\n      }\n\n      if(!deps && typeof callback === \"function\") {\n        deps = [];\n      }\n\n      // Publish module in this context's queue.\n      // A require call will process these first.\n      context.defQueue.push([id, deps, callback]);\n      context.defQueueMap[id] = true;\n\n      return requireJS;","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core-ui/src/main/resources/app/pentaho/util/requireJS.js#L30-L66","documentation":"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.","triggerScenarios":"Calling `define()` with no arguments, `define(null)`, `define(function(){...})` (anonymous module), or `define(123, ...)` with a non-string id.","commonSituations":"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.","solutions":["Add a string module id as the first argument to define()","If the module comes from a bundle, re-run the optimizer (r.js) so each define gets an explicit id","Wrap anonymous define calls with a named define shim assigning a module path"],"exampleFix":"// before\ndefine(['pentaho/util/Base'], function(Base) { ... });\n// after\ndefine('my/plugin/MyModule', ['pentaho/util/Base'], function(Base) { ... });","handlingStrategy":"validation","validationCode":"if (typeof id !== \"string\" || id.length === 0) throw new Error(\"define() requires a non-empty string module id\");","typeGuard":"function hasModuleId(args) { return args.length > 0 && typeof args[0] === \"string\" && args[0].length > 0; }","tryCatchPattern":null,"preventionTips":["Always name your define() calls with an explicit string id","Run r.js optimizer so bundled anonymous modules get ids","Lint for define(function(){}) patterns in your codebase"],"tags":["javascript","amd","module-loader"],"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"}