{"record":{"id":"5af6915cfad0fc13","repo":"pentaho/pentaho-kettle","slug":"a-module-with-the-id-or-alias-id-is-already-being-defined","errorCode":null,"errorMessage":"A module with the id or alias '{id}' is already being defined.","messagePattern":"A module with the id or alias '(.+?)' is already being defined\\.","errorType":"validation","errorClass":"ArgumentInvalidError","httpStatus":null,"severity":"error","filePath":"plugins/core-ui/src/main/resources/app/pentaho/_core/module/MetaService.js","lineNumber":105,"sourceCode":"              \"moduleSpecMap\",\n              \"Module map contains an empty module identifier.\");\n          }\n\n          if(!moduleSpec) {\n            throw new ArgumentInvalidError(\n              \"moduleSpecMap\",\n              \"Module with id '\" + id + \"' provides no specification.\");\n          }\n\n          // ---\n\n          var module = this.__get(id);\n          if(module !== null) {\n            module.__configure(moduleSpec);\n          } else {\n\n            if(O.hasOwn(preparedModuleSpecMap, id)) {\n              throw new ArgumentInvalidError(\n                \"moduleSpecMap\",\n                \"A module with the id or alias '\" + id + \"' is already being defined.\");\n            }\n\n            moduleSpec = Object.create(moduleSpec);\n            moduleSpec.id = id;\n            moduleSpec.index = nextModuleIndex++;\n\n            preparedModuleIdList.push(id);\n\n            // Index by id and by alias, if any.\n            preparedModuleSpecMap[id] = moduleSpec;\n\n            var alias = textUtil.nonEmptyString(moduleSpec.alias);\n            if(alias !== null && alias !== id) {\n              if(this.__get(alias) !== null || O.hasOwn(preparedModuleSpecMap, alias)) {\n                throw new ArgumentInvalidError(\n                  \"moduleSpecMap\",","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core-ui/src/main/resources/app/pentaho/_core/module/MetaService.js#L87-L123","documentation":"pentaho.lang.ArgumentInvalidError thrown by prepareModule when two entries in the same moduleSpecMap share the same id or alias — the id key was already added to preparedModuleSpecMap during this batch. Duplicate ids within one configuration call are rejected instead of silently overwriting.","triggerScenarios":"Calling __configure/metaService.define with a map containing the same id twice (e.g. {\"a\": specA, \"a\": specB}), or two different keys where one module's alias equals the other's id and was indexed first.","commonSituations":"Merging config objects that both define the same module; copy-paste duplication in module config; concatenating map fragments that overlap.","solutions":["Deduplicate the moduleSpecMap so each id appears once.","Merge the duplicate specs into one entry before configuring.","If intentional reconfiguration is needed, use the configure API on the existing module rather than redefining."],"exampleFix":"// before\n{\"a\": specA, \"a\": specB}\n// after\n{\"a\": Object.assign({}, specA, specB)}","handlingStrategy":"validation","validationCode":"var seen = {};\nObject.keys(map).forEach(function(k) {\n  if(seen[k]) throw new Error(\"duplicate module id/alias: \" + k);\n  seen[k] = true;\n});","typeGuard":"function hasNoDuplicates(map) { return Object.keys(map).length === Object.keys({}).concat(Object.keys(map)).filter(function(v,i,a){return a.indexOf(v)===i;}).length; }","tryCatchPattern":"try { metaService.__configure(map); } catch(e) { if(/already being defined/.test(e.message)) { console.warn(\"duplicate module entry ignored\"); } else { throw e; } }","preventionTips":["Deduplicate merged config fragments","Centralize module definitions to avoid overlapping sources"],"tags":["duplicate-key","module-configuration","conflict"],"backgroundTag":"conflicting-config-options","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"}