{"record":{"id":"43be06908f585b9b","repo":"pentaho/pentaho-kettle","slug":"repositorymeta-is-null","errorCode":null,"errorMessage":"RepositoryMeta is null","messagePattern":"RepositoryMeta is null","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/utils/IRepositoryFactory.java","lineNumber":167,"sourceCode":"      } catch ( Exception e ) {\n        throw new KettleException( \"Meta repository not populated\", e ); //$NON-NLS-1$\n      }\n\n      // Find the specified repository.\n      RepositoryMeta repositoryMeta = null;\n      try {\n        if ( singleDiServerInstance ) {\n          repositoryMeta = repositoriesMeta.findRepository( SINGLE_DI_SERVER_INSTANCE );\n        } else {\n          repositoryMeta = repositoriesMeta.findRepository( repositoryName );\n        }\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","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/utils/IRepositoryFactory.java#L149-L185","documentation":"After the lookup, connect checks repositoryMeta for null and throws 'RepositoryMeta is null'. This distinguishes the case where findRepository silently returned nothing (name not present) from exception-based failures, ensuring the factory never proceeds with a null repository definition.","triggerScenarios":"repositoriesMeta.findRepository(repositoryName) returns null because no repository with that exact name is defined (and singleDiServerInstance lookup also missed).","commonSituations":"Repository name typo; repositories.xml populated on a different machine/user profile than the one running the code; relying on a repository that was deleted from the metadata.","solutions":["Verify the repository name exists in repositories.xml exactly (case/whitespace).","Re-create the repository definition in Spoon (Manage Repositories) or edit repositories.xml.","Enumerate RepositoriesMeta.getRepositories() at runtime and log available names before connecting.","Ensure the process runs as a user whose $HOME/.kettle contains the expected repositories.xml."],"exampleFix":"// before\nRepository repo = factory.connect(\"prod\"); // name not defined anywhere\n// after\nRepositoriesMeta meta = new RepositoriesMeta(); meta.readData();\nboolean exists = Arrays.stream(meta.getRepositories()).anyMatch(r -> r.getName().equals(\"prod\"));\nif (!exists) throw new IllegalArgumentException(\"Unknown repository: prod\");\nRepository repo = factory.connect(\"prod\");","handlingStrategy":"validation","validationCode":"RepositoriesMeta meta = new RepositoriesMeta(); meta.readData();\nif (meta.findRepository(name) == null) throw new IllegalArgumentException(\"Unknown repository: \" + name);","typeGuard":null,"tryCatchPattern":"try { repo = factory.connect(name); }\ncatch (KettleException e) { if (e.getMessage().contains(\"RepositoryMeta is null\")) { /* prompt user to select valid repo */ } }","preventionTips":["Check findRepository() result before relying on a name","Keep repositories.xml in sync across environments"],"tags":["pentaho","repository","null","configuration"],"backgroundTag":"record-not-found","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"}