pentaho/pentaho-kettle · error · ArgumentInvalidError

A module with the id or alias

Error message

A module with the id or alias '{id}' is already being defined.

What it means

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.

Solutions

  1. Deduplicate the moduleSpecMap so each id appears once.
  2. Merge the duplicate specs into one entry before configuring.
  3. If intentional reconfiguration is needed, use the configure API on the existing module rather than redefining.

Example fix

// before
{"a": specA, "a": specB}
// after
{"a": Object.assign({}, specA, specB)}
Defensive patterns

Strategy: validation

Validate before calling

var seen = {};
Object.keys(map).forEach(function(k) {
  if(seen[k]) throw new Error("duplicate module id/alias: " + k);
  seen[k] = true;
});

Type guard

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; }

Try / catch

try { metaService.__configure(map); } catch(e) { if(/already being defined/.test(e.message)) { console.warn("duplicate module entry ignored"); } else { throw e; } }

Prevention

When it happens

Trigger: 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.

Common situations: Merging config objects that both define the same module; copy-paste duplication in module config; concatenating map fragments that overlap.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/5af6915cfad0fc13. Report an issue: GitHub.

Appendix: source

Thrown at plugins/core-ui/src/main/resources/app/pentaho/_core/module/MetaService.js:105

              "moduleSpecMap",
              "Module map contains an empty module identifier.");
          }

          if(!moduleSpec) {
            throw new ArgumentInvalidError(
              "moduleSpecMap",
              "Module with id '" + id + "' provides no specification.");
          }

          // ---

          var module = this.__get(id);
          if(module !== null) {
            module.__configure(moduleSpec);
          } else {

            if(O.hasOwn(preparedModuleSpecMap, id)) {
              throw new ArgumentInvalidError(
                "moduleSpecMap",
                "A module with the id or alias '" + id + "' is already being defined.");
            }

            moduleSpec = Object.create(moduleSpec);
            moduleSpec.id = id;
            moduleSpec.index = nextModuleIndex++;

            preparedModuleIdList.push(id);

            // Index by id and by alias, if any.
            preparedModuleSpecMap[id] = moduleSpec;

            var alias = textUtil.nonEmptyString(moduleSpec.alias);
            if(alias !== null && alias !== id) {
              if(this.__get(alias) !== null || O.hasOwn(preparedModuleSpecMap, alias)) {
                throw new ArgumentInvalidError(
                  "moduleSpecMap",

View on GitHub (pinned to f3058517a1)