{"record":{"id":"ef2ecf6136e465af","repo":"pentaho/pentaho-kettle","slug":"rule-select-module","errorCode":null,"errorMessage":"rule.select.module","messagePattern":"rule\\.select\\.module","errorType":"validation","errorClass":"ArgumentRequiredError","httpStatus":null,"severity":"error","filePath":"plugins/core-ui/src/main/resources/app/pentaho/_core/config/Service.js","lineNumber":161,"sourceCode":"       *\n       * @param {pentaho.config.spec.IRule} rule - The configuration rule to add.\n       * @param {?string} [contextId] - The module identifier to which rule `modules` and `deps`\n       * are relative to. Also, this module determines any applicable AMD/RequireJS mappings.\n       *\n       * @throw {pentaho.lang.OperationInvalidError} When `rule` has relative dependencies and `contextId`\n       * is not specified.\n       */\n      addRule: function(rule, contextId) {\n\n        // Assuming the Service takes ownership of the rules,\n        // so mutating it directly is ok.\n        rule._ordinal = __ruleCounter++;\n\n        var select = rule.select || {};\n\n        var moduleIds = select.module;\n        if(!moduleIds) {\n          throw new ArgumentRequiredError(\"rule.select.module\");\n        }\n\n        var applicationId = select.application;\n        if(applicationId) {\n          if(Array.isArray(applicationId)) {\n            select.application = applicationId.map(function(appId) {\n              return resolveId(appId, contextId);\n            });\n          } else {\n            select.application = resolveId(applicationId, contextId);\n          }\n        }\n\n        if(this.__applySelector(select)) {\n\n          var annotationId = select.annotation || null;\n          if(annotationId !== null) {\n            annotationId = resolveAnnotationId(annotationId, contextId);","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core-ui/src/main/resources/app/pentaho/_core/config/Service.js#L143-L179","documentation":"The Pentaho core-ui config Service's __addRule validates that each match rule has a select.module. If rule.select is empty or select.module is null/undefined, it throws ArgumentRequiredError(\"rule.select.module\"). This is a fail-fast validation: a match rule cannot be registered without specifying which module(s) it applies to.","triggerScenarios":"Registering a rule via the config Service where the rule object's select.module property is missing or falsy — e.g. a rule like {name:'x', rule:{...}} with no select at all, or select:{application:'app1'} without module.","commonSituations":"Typo in configuration ('modules' instead of 'module'); copying a rule config and deleting the module selector; dynamically built rule objects where module resolution failed upstream and produced undefined; AMD/module ID refactoring renaming modules without updating rules.","solutions":["Add a select.module (string or array) to the rule configuration, e.g. select:{module:'pentaho/myModule'}.","Fix typos in the config key so it is exactly 'module'.","Log/inspect the rule object being registered to see why select.module is undefined (trace where the rule was built).","If module IDs were renamed, update the rule's module IDs to the new names."],"exampleFix":"// before\nservice.addRule({\n  name: \"myRule\",\n  rule: { priority: 1 }\n});\n// after\nservice.addRule({\n  name: \"myRule\",\n  select: { module: \"pentaho/type/Context\" },\n  rule: { priority: 1 }\n});","handlingStrategy":"validation","validationCode":"function assertRuleHasModule(rule) {\n  if (!rule || !rule.select || !rule.select.module) {\n    throw new Error(\"Rule config missing select.module: \" + JSON.stringify(rule));\n  }\n}","typeGuard":"function hasSelectModule(rule) {\n  return rule != null && rule.select != null &&\n    (typeof rule.select.module === \"string\" ? rule.select.module.length > 0 : Array.isArray(rule.select.module));\n}","tryCatchPattern":"try {\n  service.addRule(ruleDef);\n} catch (ex) {\n  if (ex.name === \"ArgumentRequiredError\" && ex.message.indexOf(\"rule.select.module\") >= 0) {\n    logger.error(\"Rule '\" + ruleDef.name + \"' is missing select.module — fix config\", ex);\n  } else { throw ex; }\n}","preventionTips":["Validate rule configs (schema/lint) before registering them with the config Service.","Watch for key typos: it is 'module', not 'modules'.","Unit-test rule registration with representative configs.","Log full rule objects on registration failure."],"tags":["javascript","configuration","validation","pentaho"],"backgroundTag":"missing-required-config-field","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"}