{"record":{"id":"3f9b94d1b2ef0dbf","repo":"pentaho/pentaho-kettle","slug":"could-not-get-repository-instance","errorCode":null,"errorMessage":"Could not get repository instance","messagePattern":"Could not get repository instance","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/utils/IRepositoryFactory.java","lineNumber":178,"sourceCode":"        }\n\n      } catch ( Exception e ) {\n        throw new KettleException( \"Repository not found\", e ); //$NON-NLS-1$\n      }\n\n      if ( repositoryMeta == null ) {\n        throw new KettleException( \"RepositoryMeta is null\" ); //$NON-NLS-1$\n      }\n\n      Repository repository = null;\n      try {\n        repository =\n            PluginRegistry.getInstance().loadClass( RepositoryPluginType.class, repositoryMeta.getId(),\n                Repository.class );\n        repository.init( repositoryMeta );\n\n      } catch ( Exception e ) {\n        throw new KettleException( \"Could not get repository instance\", e ); //$NON-NLS-1$\n      }\n\n      // Two scenarios here: internal to server or external to server. If internal, you are already authenticated. If\n      // external, you must provide a username and additionally specify that the IP address of the machine running this\n      // code is trusted.\n      repository.connect( PentahoSessionHolder.getSession().getName(), \"password\" );\n\n      return repository;\n    }\n  }\n}\n","sourceCodeStart":160,"sourceCodeEnd":190,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/utils/IRepositoryFactory.java#L160-L190","documentation":"connect instantiates the Repository implementation via PluginRegistry.loadClass(RepositoryPluginType, repositoryMeta.getId(), Repository.class) and calls repository.init(repositoryMeta). Any failure loading the plugin class or initializing it (missing plugin, bad metadata, init exception) is wrapped in 'Could not get repository instance'. The underlying repository was found; its implementation could not be constructed.","triggerScenarios":"PluginRegistry cannot load a Repository class for the repositoryMeta.getId() plugin id — plugin jar absent from the classpath, plugin id mismatch, or repository.init() throwing.","commonSituations":"Deploying an app with kettle-core but omitting the pur/repository plugin jars; version mismatch where the plugin id changed between Pentaho versions; classpath isolation (shaded jars / OSGi) hiding the plugin registry contents.","solutions":["Add the missing repository plugin to the classpath (e.g., pentaho-pdi pur plugin jars) for the repositoryMeta id being used.","Verify repositoryMeta.getId() matches a registered plugin: check PluginRegistry plugins of type RepositoryPluginType.","Inspect the chained cause for the loadClass/init exception and fix the underlying init error.","Align Pentaho/Kettle library versions so plugin ids match your repository metadata."],"exampleFix":"// before\nKettleEnvironment.init(); // plugins not loaded\nRepository repo = factory.connect(\"PurRepo\");\n// after\nKettleEnvironment.init(false);\nPluginRegistry.getInstance().getPlugins(RepositoryPluginType.class); // ensure 'PurRepository' plugin present\nRepository repo = factory.connect(\"PurRepo\");","handlingStrategy":"validation","validationCode":"boolean pluginLoaded = PluginRegistry.getInstance().getPlugins(RepositoryPluginType.class)\n  .stream().anyMatch(p -> p.getIds()[0].equals(repoMetaId));\nif (!pluginLoaded) throw new IllegalStateException(\"Repository plugin not on classpath: \" + repoMetaId);","typeGuard":null,"tryCatchPattern":"try { repo = factory.connect(name); }\ncatch (KettleException e) { if (e.getMessage().contains(\"Could not get repository instance\")) { log.error(\"Plugin load/init failure\", e.getCause()); } }","preventionTips":["Ship all repository plugin jars with your app","Call KettleEnvironment.init() before connecting","Match Pentaho library versions to repository metadata"],"tags":["pentaho","plugin-registry","repository","classpath"],"backgroundTag":"module-init-failed","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"}