{"record":{"id":"bfb955e05f476bc4","repo":"pentaho/pentaho-kettle","slug":"repositorymeta-error-openingfile","errorCode":null,"errorMessage":"RepositoryMeta.Error.OpeningFile","messagePattern":"RepositoryMeta\\.Error\\.OpeningFile","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/RepositoriesMeta.java","lineNumber":211,"sourceCode":"    }\n\n    if ( log.isBasic() ) {\n      log.logBasic( BaseMessages.getString( PKG, \"RepositoryMeta.Log.ReadingXMLFile\", file.getAbsoluteFile() ) );\n    }\n\n    try {\n      // Check and open XML document\n      DocumentBuilderFactory dbf = XMLParserFactoryProducer.createSecureDocBuilderFactory();\n      DocumentBuilder db = dbf.newDocumentBuilder();\n      Document doc;\n      try {\n        doc = db.parse( file );\n      } catch ( FileNotFoundException ef ) {\n        try ( InputStream is = getClass().getResourceAsStream( \"/org/pentaho/di/repository/repositories.xml\" ) ) {\n          if ( is != null ) {\n            doc = db.parse( is );\n          } else {\n            throw new KettleException( BaseMessages.getString( PKG, \"RepositoryMeta.Error.OpeningFile\", file.getAbsoluteFile() ), ef );\n          }\n        }\n      }\n      parseRepositoriesDoc( doc );\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"RepositoryMeta.Error.ReadingInfo\" ), e );\n    }\n\n    return true;\n  }\n\n  public String getKettleUserRepositoriesFile() {\n    return Const.getKettleUserRepositoriesFile();\n  }\n\n  String getKettleLocalRepositoriesFile() {\n    return Const.getKettleLocalRepositoriesFile();\n  }","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/RepositoriesMeta.java#L193-L229","documentation":"RepositoriesMeta.readData throws KettleException with RepositoryMeta.Error.OpeningFile when the specified repositories.xml file does not exist AND the classpath fallback resource /org/pentaho/di/repository/repositories.xml is also absent. The original FileNotFoundException is chained.","triggerScenarios":"Calling readData/loadRepositoryInfo with a File that does not exist on disk and no default repositories.xml packaged on the classpath.","commonSituations":"First run on a machine where Spoon was never started (no ~/.kettle/repositories.xml); wrong KETTLE_HOME pointing to an empty directory; typo in the repositories file path.","solutions":["Create repositories.xml by launching Spoon once and connecting to a repository, or copy one from a working machine","Point the loader at an existing file path (or set KETTLE_HOME) so the File exists","Ship a default repositories.xml on the classpath for embedded/headless deployments","Verify the absolute path passed to readData with File.exists() beforehand"],"exampleFix":"// before\nRepositoriesMeta repos = new RepositoriesMeta();\nrepos.readData(new File(\"/nonexistent/repositories.xml\"));\n// after\nFile f = new File(System.getProperty(\"user.home\") + \"/.kettle/repositories.xml\");\nif (!f.exists()) throw new IllegalStateException(\"Run Spoon once to create repositories.xml at \" + f);\nrepos.readData(f);","handlingStrategy":"validation","validationCode":"java.io.File f = new java.io.File(repoXmlPath);\nif (!f.isFile()) {\n  // fall back to the default location\n  f = new java.io.File(System.getProperty(\"user.home\") + \"/.kettle/repositories.xml\");\n  if (!f.isFile()) throw new IllegalStateException(\"repositories.xml not found; run Spoon once or set KETTLE_HOME\");\n}\nRepositoriesMeta meta = new RepositoriesMeta();\nmeta.readData(f);","typeGuard":"static boolean repositoriesFileExists(java.io.File f) { return f != null && f.isFile() && f.length() > 0; }","tryCatchPattern":"try {\n  reposMeta.readData(file);\n} catch (KettleException e) {\n  if (e.getCause() instanceof java.io.FileNotFoundException) {\n    throw new IllegalStateException(\"repositories.xml missing at \" + file.getAbsolutePath() + \" — create it via Spoon or ship it on the classpath\", e);\n  }\n  throw e;\n}","preventionTips":["Ship a default repositories.xml resource for headless deployments","Set KETTLE_HOME explicitly in service launch scripts","Check File.exists() before readData","Provision repositories.xml in container images / CI agents"],"tags":["repository","file","file-not-found","pan"],"backgroundTag":"config-file-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"}