{"record":{"id":"da44e31962083f69","repo":"pentaho/pentaho-kettle","slug":"unable-to-find-repository-directory","errorCode":null,"errorMessage":"Unable to find repository directory [","messagePattern":"Unable to find repository directory \\[","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/job/entries/job/JobEntryJob.java","lineNumber":1437,"sourceCode":"  public JobMeta getJobMeta( Repository rep, VariableSpace space ) throws KettleException {\n    parentJobMeta.getMetaFileCache( ); //Get the cache from the parent or create it\n    return getJobMeta( rep, getMetaStore(), space );\n  }\n\n  protected JobMeta getJobMetaFromRepository( Repository rep, CurrentDirectoryResolver r, String transPath, VariableSpace tmpSpace ) throws KettleException {\n    String realJobName = \"\";\n    String realDirectory = \"/\";\n\n    int index = transPath.lastIndexOf( RepositoryFile.SEPARATOR );\n    if ( index != -1 ) {\n      realJobName = transPath.substring( index + 1 );\n      realDirectory = index == 0 ? RepositoryFile.SEPARATOR : transPath.substring( 0, index );\n    }\n\n    realDirectory = r.normalizeSlashes( realDirectory );\n    RepositoryDirectoryInterface repositoryDirectory = rep.loadRepositoryDirectoryTree().findDirectory( realDirectory );\n    if ( repositoryDirectory == null ) {\n      throw new KettleException( \"Unable to find repository directory [\" + Const.NVL( realDirectory, \"\" ) + \"]\" );\n    }\n    JobMeta jobMeta = rep.loadJob( realJobName, repositoryDirectory, null, null ); //reads\n    if ( jobMeta != null ) {\n      jobMeta.initializeVariablesFrom( tmpSpace );\n    }\n    return jobMeta;\n  }\n\n  public JobMeta getJobMeta( Repository rep, IMetaStore metaStore, VariableSpace space ) throws KettleException {\n    try {\n      IMetaFileLoader<JobMeta> metaFileLoader = new MetaFileLoaderImpl<>( this, specificationMethod );\n      JobMeta jobMeta = metaFileLoader.getMetaForEntry( parentJobMeta.getBowl(), rep, metaStore, space );\n\n      if ( jobMeta != null ) {\n        jobMeta.setRepository( rep );\n        jobMeta.setMetaStore( metaStore );\n      }\n","sourceCodeStart":1419,"sourceCodeEnd":1455,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/job/entries/job/JobEntryJob.java#L1419-L1455","documentation":"getJobMetaFromRepository() parses a repository path (transPath like /dir/subdir/jobname), normalizes the directory part, and looks it up via rep.loadRepositoryDirectoryTree().findDirectory(realDirectory). When no repository directory matches, it throws this KettleException embedding the directory that was not found.","triggerScenarios":"Calling getJobMeta with specificationMethod REPOSITORY_BY_NAME where the directory field (or a combined path variable) resolves to a path absent from the repository tree — e.g. '/production/monthly' renamed to '/prod/monthly', or a variable substituting to an empty/garbage path.","commonSituations":"Repository directories reorganized between environments; variable ${JOB_DIR} undefined so the path is wrong; case-sensitive path mismatch on the repository DB; repository not connected so the directory tree fails to load.","solutions":["Verify the directory path in the Job entry exists in the repository (Browse button) and correct it","Fix or define the variables that build the directory path at runtime","Recreate renamed/moved directories in the repository or update all referencing job entries","Confirm the repository connection is live so loadRepositoryDirectoryTree() returns the full tree"],"exampleFix":"// before: Directory: ${JOB_DIR}\n// after: ensure it resolves and exists before execute\nString dir = environmentSubstitute(getVariable(\"JOB_DIR\", \"/prod\"));\nif (rep.loadRepositoryDirectoryTree().findDirectory(dir) == null) {\n  setVariable(\"JOB_DIR\", \"/prod\");\n}","handlingStrategy":"validation","validationCode":"String dir = environmentSubstitute(jobEntry.getDirectory());\nRepositoryDirectoryInterface tree = rep.loadRepositoryDirectoryTree();\nif (dir != null && !dir.isEmpty() && tree.findDirectory(dir) == null) {\n  throw new IllegalArgumentException(\"Repository directory does not exist: \" + dir);\n}","typeGuard":null,"tryCatchPattern":"try {\n  JobMeta jm = jobEntry.getJobMeta(rep, metaStore, space);\n} catch (KettleException e) {\n  if (e.getMessage().startsWith(\"Unable to find repository directory\")) {\n    // correct the directory path or create it in the repository\n  }\n  throw e;\n}","preventionTips":["Use the Browse button to select repository directories instead of typing paths","Define all variables that participate in the directory path before execution","Keep repository directory structures consistent across environments (deployment scripts)","Confirm the repository connection is open before loading the directory tree"],"tags":["pdi","kettle","repository","path"],"backgroundTag":"directory-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"}