{"record":{"id":"8b5d9e554d360d1b","repo":"pentaho/pentaho-kettle","slug":"error-0018-meta-repository-not-populated","errorCode":"ERROR_0018_META_REPOSITORY_NOT_POPULATED","errorMessage":"RepositoryConnectionUtils.ERROR_0018_META_REPOSITORY_NOT_POPULATED","messagePattern":"RepositoryConnectionUtils\\.ERROR_0018_META_REPOSITORY_NOT_POPULATED","errorType":"error_code","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/RepositoryConnectionUtils.java","lineNumber":81,"sourceCode":"    }\n\n    try {\n      if ( isSingleDiServerInstance ) {\n        if ( logger.isDebugEnabled() ) {\n          logger.debug( \"singleDiServerInstance=true, loading default repository\" );\n        }\n\n        // Get the embedded repository xml\n        String repositoriesXml = getEmbeddedDefaultRepositoryXml( fullyQualifiedServerUrl );\n\n        ByteArrayInputStream sbis = new ByteArrayInputStream( repositoriesXml.getBytes( Const.XML_ENCODING ) );\n        repositoriesMeta.readDataFromInputStream( sbis );\n      } else {\n        // TODO: add support for specified repositories.xml files...\n        repositoriesMeta.readData(); // Read from the default $HOME/.kettle/repositories.xml file.\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        \"RepositoryConnectionUtils.ERROR_0018_META_REPOSITORY_NOT_POPULATED\" ), e ); //$NON-NLS-1$\n    }\n\n    if ( logger.isDebugEnabled() ) {\n      logger.debug( \" Finding repository metadata\" );\n    }\n    // Find the specified repository.\n    RepositoryMeta repositoryMeta = null;\n    try {\n      if ( isSingleDiServerInstance ) {\n        repositoryMeta = repositoriesMeta.findRepository( SINGLE_DI_SERVER_INSTANCE );\n      } else {\n        repositoryMeta = repositoriesMeta.findRepository( repositoryName );\n      }\n\n\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG,","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/RepositoryConnectionUtils.java#L63-L99","documentation":"RepositoryConnectionUtils.connectToRepository loads repository metadata from either a supplied stream or the default repositories.xml before connecting. If that loading step throws any exception, it is rethrown as a KettleException with ERROR_0018_META_REPOSITORY_NOT_POPULATED — meaning the RepositoriesMeta object could not be populated, so no repository can be selected.","triggerScenarios":"Calling RepositoryConnectionUtils.connectToRepository(...) where readDataFromInputStream(stream) or readData() throws — i.e. missing, unreadable, or malformed ~/.kettle/repositories.xml (or a broken supplied stream).","commonSituations":"Headless server/job where HOME is not set so repositories.xml cannot be found; corrupted repositories.xml after a crash; deploying without shipping a repositories.xml; permission problems in the user's home directory.","solutions":["Fix or restore the repositories.xml file that readData()/readDataFromInputStream failed on (check the cause chain).","Verify HOME/KETTLE_HOME points to a directory containing a readable repositories.xml for the running user.","If a stream is supplied, confirm it delivers complete valid repositories.xml bytes before this call.","Create a valid repositories.xml via Spoon or RepositoriesMeta.writeData() on a working machine and copy it over.","Pre-validate with new RepositoriesMeta().readData() in a try block and give a clearer error if it fails."],"exampleFix":"// before: opaque ERROR_0018 when file is missing\nrepository = RepositoryConnectionUtils.connectToRepository(log, null, \"repo1\", user, pass, null, false);\n// after: pre-check the metadata file\nFile reposXml = new File(System.getProperty(\"user.home\") + \"/.kettle/repositories.xml\");\nif (!reposXml.canRead()) {\n  throw new IllegalStateException(\"repositories.xml missing/unreadable: \" + reposXml);\n}\nrepository = RepositoryConnectionUtils.connectToRepository(log, null, \"repo1\", user, pass, null, false);","handlingStrategy":"validation","validationCode":"File reposXml = new File(System.getProperty(\"user.home\") + \"/.kettle/repositories.xml\");\nif (!reposXml.canRead()) throw new IllegalStateException(\"repositories.xml not readable: \" + reposXml);\nnew RepositoriesMeta().readData(); // dry-run before real connect","typeGuard":null,"tryCatchPattern":"try { rep = RepositoryConnectionUtils.connectToRepository(...); } catch (KettleException e) { if (e.getMessage().contains(\"ERROR_0018\")) { /* metadata not populated: fix repositories.xml */ } throw e; }","preventionTips":["Ship a valid repositories.xml with headless deployments","Set HOME/KETTLE_HOME explicitly for service accounts","Dry-run RepositoriesMeta.readData() at startup to fail early with a clear message"],"tags":["repository-connection","metadata","config","pdi"],"backgroundTag":"missing-config-file","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"}