pentaho/pentaho-kettle · error · ArgumentInvalidError

Must be or identify a type module.

Error message

Must be or identify a type module.

What it means

TypeMeta.isSubtypeOf accepts either a TypeMeta instance or a string module id/alias. ArgumentInvalidError is thrown when the provided value is neither: the string id did not resolve (moduleMetaService.get with assert would throw earlier, so here the value is a non-TypeMeta object, number, boolean, etc.).

Solutions

  1. Pass a string module id/alias instead of an object, so the service resolves it
  2. Resolve the module first via core.moduleMetaService.get(id) and pass the returned TypeMeta
  3. Check the value type before calling: instanceof TypeMeta or typeof === 'string'

Example fix

// before
var isSub = someType.isSubtypeOf({id: 'pentaho/type/string'});
// after
var isSub = someType.isSubtypeOf('pentaho/type/string');
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(typeof baseId === 'string' || baseId instanceof TypeMeta)) throw new Error('baseIdOrAlias must be a string id or TypeMeta');

Type guard

function isTypeMetaLike(v) { return typeof v === 'string' || (v && v instanceof TypeMeta); }

Try / catch

try { return type.isSubtypeOf(baseIdOrAlias); } catch (e) { if (e instanceof ArgumentInvalidError) { console.warn('Invalid base type argument', baseIdOrAlias); return false; } throw e; }

Prevention

When it happens

Trigger: Calling isSubtypeOf with a non-string object that is not a TypeMeta instance (e.g. a plain object, a module descriptor object, or a wrong class instance).

Common situations: Passing a raw module config object instead of resolving it to its metadata; passing the result of another API that returns something other than TypeMeta; API/version changes where the service returns plain objects.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

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

          this.__instances = instances = [];
        }

        instances.push(instance);
      },
      // endregion

      /** @inheritDoc  */
      isSubtypeOf: function(baseIdOrAlias) {
        if(!baseIdOrAlias) {
          throw new ArgumentRequiredError("baseIdOrAlias");
        }

        var baseModule = typeof baseIdOrAlias === "string"
          ? core.moduleMetaService.get(baseIdOrAlias, keyArgsAssertDefined)
          : baseIdOrAlias;

        if(!(baseModule instanceof TypeMeta)) {
          throw new ArgumentInvalidError("baseIdOrAlias", "Must be or identify a type module.");
        }

        var subModule = this;
        do {
          if(baseModule === subModule) {
            return true;
          }

          subModule = subModule.ancestor;
        } while(subModule !== null);

        return false;
      },

      /** @override */
      _prepareCoreAsync: function() {

        if(this.ancestor !== null) {

View on GitHub (pinned to f3058517a1)