pentaho/pentaho-kettle · error · ArgumentInvalidError

Expected module with id or alias

Error message

Expected module with id or alias '{idOrAlias}' to be a type module.

What it means

pentaho.lang.ArgumentInvalidError thrown by __getTypeModule (used by MetaService.type) when the module resolved from the given id or alias exists but its kind is not "type". The type() API only accepts type modules; instance modules are rejected via the caller-supplied argument name.

Solutions

  1. Pass the id or alias of a type module to type().
  2. Fix the alias so it points to the type module you intend.
  3. If you need an instance module, use the appropriate API instead of type().

Example fix

// before
var Model = metaService.type("my/modelInstance"); // instance module
// after
var Model = metaService.type("pentaho/visual/models/bar");
Defensive patterns

Strategy: validation

Validate before calling

var m = metaService.get(idOrAlias);
if(m && m.kind !== "type") throw new Error("'" + idOrAlias + "' is not a type module");
var T = metaService.type(idOrAlias);

Type guard

function isTypeModuleId(id) { var m = metaService.get(id); return m !== null && m.kind === "type"; }

Try / catch

try { T = metaService.type(idOrAlias); } catch(e) { if(/to be a type module/.test(e.message)) { T = null; } else { throw e; } }

Prevention

When it happens

Trigger: Calling metaService.type(idOrAlias) where the id/alias resolves to a registered module of another kind, such as an instance module.

Common situations: Passing an instance/implementation module id or its alias instead of the model/type id; alias collisions that map a name to a non-type module; API migration where an id that used to be a type became an instance module.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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

Appendix: source

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

    }

    /**
     * Gets a type module given its identifier or alias.
     *
     * @param {pentaho.module.IMetaService} metaService - The module metadata service.
     * @param {nonEmptyString} idOrAlias - The identifier or alias of the module.
     * @param {nonEmptyString} argName - The name of the argument.
     *
     * @return {pentaho.module.ITypeMeta} The desired type module.
     *
     * @throws {pentaho.lang.ArgumentInvalidError} When the module is defined but is not a type module.
     */
    function __getTypeModule(metaService, idOrAlias, argName) {

      var module = metaService.get(idOrAlias);

      if(module !== null && module.kind !== "type") {
        throw new ArgumentInvalidError(
          argName,
          "Expected module with id or alias '" + idOrAlias + "' to be a type module.");
      }

      return module;
    }

    /**
     * The module comparer function.
     *
     * Implements the global order of modules: ranking descending + index ascending.
     *
     * @param {pentaho.module.ITypeMeta} moduleA - The first module.
     * @param {pentaho.module.ITypeMeta} moduleB - The second module.
     *
     * @return {number} The comparison result.
     */
    function __moduleComparer(moduleA, moduleB) {

View on GitHub (pinned to f3058517a1)