pentaho/pentaho-kettle · error · ArgumentRequiredError

typeIdOrAlias

Error message

typeIdOrAlias

What it means

InstanceMeta.isInstanceOf(typeIdOrAlias) checks whether the instance's type is a subtype of the given type ID or alias. If typeIdOrAlias is falsy (null, undefined, empty string), it throws ArgumentRequiredError("typeIdOrAlias") instead of returning false. Callers must supply a non-empty type identifier.

Solutions

  1. Pass a valid non-empty type ID or alias, e.g. instance.isInstanceOf('pentaho/type/string').
  2. Add a guard at the call site: only call isInstanceOf when the ID is known (if (typeId) ...).
  3. Trace why the variable holding the type ID is empty (resolution order, async load) and fix upstream.
  4. If the intent was 'is it of any type', use an explicit check against the base type or restructure the logic rather than passing null.

Example fix

// before
var typeId = getTypeFromConfig(); // may be undefined
if (instance.isInstanceOf(typeId)) { ... }
// after
var typeId = getTypeFromConfig();
if (typeId && instance.isInstanceOf(typeId)) { ... }
Defensive patterns

Strategy: type-guard

Validate before calling

if (typeof typeIdOrAlias !== "string" || typeIdOrAlias.length === 0) {
  throw new Error("typeIdOrAlias must be a non-empty string");
}

Type guard

function isValidTypeId(typeIdOrAlias) {
  return typeof typeIdOrAlias === "string" && typeIdOrAlias.trim().length > 0;
}

Try / catch

try {
  result = instance.isInstanceOf(typeId);
} catch (ex) {
  if (ex.name === "ArgumentRequiredError" && ex.message === "typeIdOrAlias") {
    logger.warn("isInstanceOf called with empty type ID; treating as false");
    result = false;
  } else { throw ex; }
}

Prevention

When it happens

Trigger: Calling instance.isInstanceOf(x) where x comes from an unresolved variable, an empty config value, a failed type resolution, or a function parameter not passed by the caller.

Common situations: Type metadata loaded asynchronously and the ID variable not yet set; refactoring where a typeId constant was removed; chaining code like isInstanceOf(typeOf(thing)) where typeOf returns undefined for unknown objects; empty string from a split/lookup by key.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

       * @param {pentaho.module.spec.IInstanceMeta} spec - The specification of the metadata of the instance module.
       * @param {pentaho._core.module.Resolver} resolver - The module resolver function.
       */
      constructor: function(id, spec, resolver) {

        this.base(id, spec, resolver);

        var type = spec.type || null;

        this.type = type && resolver(type, "type");
        if(type) {
          this.type.__addInstance(this);
        }
      },

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

        return this.type !== null && this.type.isSubtypeOf(typeIdOrAlias);
      },

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

        if(this.type !== null) {
          return this.type.prepareAsync().then(this.base.bind(this));
        }

        return this.base();
      }
    });
  };
});

View on GitHub (pinned to f3058517a1)