{"record":{"id":"b09f9eca64d86898","repo":"pentaho/pentaho-kettle","slug":"expected-module-id-to-be-expectedkind","errorCode":null,"errorMessage":"Expected module '{id}' to be {expectedKind}","messagePattern":"Expected module '(.+?)' to be (.+?)","errorType":"validation","errorClass":"ArgumentInvalidError","httpStatus":null,"severity":"error","filePath":"plugins/core-ui/src/main/resources/app/pentaho/_core/module/MetaService.js","lineNumber":147,"sourceCode":"          }\n        }\n\n        function moduleResolver(idOrAlias, expectedKind) {\n\n          var module = me.__get(idOrAlias);\n          if(module === null) {\n            var preparedModuleSpec = O.getOwn(preparedModuleSpecMap, idOrAlias, null);\n            if(preparedModuleSpec === null) {\n              throw new ArgumentInvalidError(\n                \"moduleSpecMap\",\n                \"A module with id '\" + idOrAlias + \"' is not defined.\");\n            }\n\n            module = createModule(preparedModuleSpec);\n          }\n\n          if(expectedKind && module.kind !== expectedKind) {\n            throw new ArgumentInvalidError(\n              \"moduleSpecMap\",\n              \"Expected module '\" + module.id + \"' to be \" + (expectedKind === \"type\" ? \"a \" : \"an \") + expectedKind);\n          }\n\n          return module;\n        }\n\n        function createModule(preparedModuleSpec) {\n\n          var module;\n          if((\"ancestor\" in preparedModuleSpec) || (\"base\" in preparedModuleSpec)) {\n            // A Type module.\n            module = new core.TypeModuleMeta(preparedModuleSpec.id, preparedModuleSpec, moduleResolver);\n          } else {\n            // An Instance module.\n            module = new core.InstanceModuleMeta(preparedModuleSpec.id, preparedModuleSpec, moduleResolver);\n          }\n","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core-ui/src/main/resources/app/pentaho/_core/module/MetaService.js#L129-L165","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n{\"my/model\": {\"type\": \"someInstanceModuleAlias\"}}\n// after\n{\"my/model\": {\"type\": \"pentaho/visual/models/bar\"}} // a type module","handlingStrategy":"validation","validationCode":"var m = metaService.get(id);\nif(m && m.kind !== \"type\") throw new Error(\"'\" + id + \"' is not a type module\");","typeGuard":"function isTypeModule(m) { return m != null && m.kind === \"type\"; }","tryCatchPattern":"try { metaService.__configure(map); } catch(e) { if(/Expected module/.test(e.message)) { console.error(\"kind mismatch in moduleSpecMap:\", e.message); } else { throw e; } }","preventionTips":["Verify module.kind before wiring dependencies","Keep aliases pointing at same-kind modules"],"tags":["kind-mismatch","type-mismatch","module-resolution"],"backgroundTag":"type-mismatch","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}