pentaho/pentaho-kettle · error · ArgumentInvalidError
Expected module ' ' to be
Error message
Expected module '{id}' to be {expectedKind} What it means
pentaho.lang.ArgumentInvalidError thrown by moduleResolver when the resolved module's `kind` does not match the expectedKind required by the resolution context (e.g. expected "type" but got an instance module, or vice versa). The module exists but is of the wrong category for this use.
Solutions
- Point the dependency at a module whose kind matches expectedKind.
- Register/create the module with the correct kind specification.
- Check what the alias resolves to — redefine the alias to the correct module.
Example fix
// before
{"my/model": {"type": "someInstanceModuleAlias"}}
// after
{"my/model": {"type": "pentaho/visual/models/bar"}} // a type module Defensive patterns
Strategy: validation
Validate before calling
var m = metaService.get(id);
if(m && m.kind !== "type") throw new Error("'" + id + "' is not a type module"); Type guard
function isTypeModule(m) { return m != null && m.kind === "type"; } Try / catch
try { metaService.__configure(map); } catch(e) { if(/Expected module/.test(e.message)) { console.error("kind mismatch in moduleSpecMap:", e.message); } else { throw e; } } Prevention
- Verify module.kind before wiring dependencies
- Keep aliases pointing at same-kind modules
When it happens
Trigger: Resolving a dependency slot that requires kind "type" (or another kind) but the id/alias points to a module of a different kind — e.g. passing an instance module id where a type module id is expected.
Common situations: Confusing a type module id with its instance/implementation id in module config; an alias pointing at the wrong kind of module; refactoring that changed a module's kind without updating dependents.
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
- AuthenticationManager.ConsumedTypeError
- AvroInput.Error.UnexpectedRecordFieldTypeAtNonExpansionPoint
- BaseStep.SafeMode.Exception.MixingTypes
- Can't encode object of class : className
- Cannot convert value to Base.Array.
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/b09f9eca64d86898.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/core-ui/src/main/resources/app/pentaho/_core/module/MetaService.js:147
}
}
function moduleResolver(idOrAlias, expectedKind) {
var module = me.__get(idOrAlias);
if(module === null) {
var preparedModuleSpec = O.getOwn(preparedModuleSpecMap, idOrAlias, null);
if(preparedModuleSpec === null) {
throw new ArgumentInvalidError(
"moduleSpecMap",
"A module with id '" + idOrAlias + "' is not defined.");
}
module = createModule(preparedModuleSpec);
}
if(expectedKind && module.kind !== expectedKind) {
throw new ArgumentInvalidError(
"moduleSpecMap",
"Expected module '" + module.id + "' to be " + (expectedKind === "type" ? "a " : "an ") + expectedKind);
}
return module;
}
function createModule(preparedModuleSpec) {
var module;
if(("ancestor" in preparedModuleSpec) || ("base" in preparedModuleSpec)) {
// A Type module.
module = new core.TypeModuleMeta(preparedModuleSpec.id, preparedModuleSpec, moduleResolver);
} else {
// An Instance module.
module = new core.InstanceModuleMeta(preparedModuleSpec.id, preparedModuleSpec, moduleResolver);
}
View on GitHub (pinned to f3058517a1)