{"record":{"id":"85977a2ea15e7f72","repo":"pentaho/pentaho-kettle","slug":"unable-to-save-directory-dir-in-the-repository","errorCode":null,"errorMessage":"Unable to save directory [ + dir + ] in the repository","messagePattern":"Unable to save directory \\[ \\+ dir \\+ \\] in the repository","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/filerep/KettleFileRepository.java","lineNumber":392,"sourceCode":"    newDir.setObjectId( new StringObjectId( calcObjectId( newDir ) ) );\n\n    return newDir;\n  }\n\n  @Override\n  public void saveRepositoryDirectory( RepositoryDirectoryInterface dir ) throws KettleException {\n    try {\n      String filename = calcDirectoryName( dir );\n      ObjectId objectId = new StringObjectId( calcRelativeElementDirectory( dir ) );\n\n      FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename );\n      fileObject.createFolder(); // also create parents\n\n      dir.setObjectId( objectId );\n\n      log.logDetailed( \"New id of directory = \" + dir.getObjectId() );\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to save directory [\" + dir + \"] in the repository\", e );\n    }\n  }\n\n  private void delObject( ObjectId id ) throws KettleException {\n    String filename = calcFilename( id );\n    deleteFile( filename );\n  }\n\n  @Override\n  public void deleteJob( ObjectId id_job ) throws KettleException {\n    delObject( id_job );\n  }\n\n  @Override\n  public void deleteTransformation( ObjectId id_transformation ) throws KettleException {\n    delObject( id_transformation );\n  }\n","sourceCodeStart":374,"sourceCodeEnd":410,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/filerep/KettleFileRepository.java#L374-L410","documentation":"Thrown by KettleFileRepository.saveRepositoryDirectory() when persisting a RepositoryDirectory fails — typically because the underlying VFS folder creation (which also creates parents) failed. The exception wraps the root cause and names the directory that could not be saved.","triggerScenarios":"Calling saveRepositoryDirectory(dir) when the computed directory path cannot be created or resolved: parent folder missing and not creatable, permission denied, path conflicts with an existing file, or VFS/FileObject errors.","commonSituations":"Saving a directory tree into a read-only repo location; folder names with illegal filesystem characters; network share temporarily unavailable; repo base directory moved or deleted while the session is open.","solutions":["Examine the chained cause to determine the exact VFS/IO failure.","Ensure the repository base directory exists and is writable before saving directories.","Check the directory name for OS-illegal characters and rename it.","Reconnect/refresh the repository if the underlying filesystem location changed mid-session."],"exampleFix":"// before: saving into a moved repo base\nrepo.saveRepositoryDirectory(dir);\n\n// after: verify base dir is live and writable first\nif (!Files.isDirectory(Paths.get(repoBaseDir)) || !Files.isWritable(Paths.get(repoBaseDir))) {\n  throw new IllegalStateException(\"Invalid repository base: \" + repoBaseDir);\n}\nrepo.saveRepositoryDirectory(dir);","handlingStrategy":"try-catch","validationCode":"boolean baseOk = Files.isDirectory(Paths.get(repoBaseDir)) && Files.isWritable(Paths.get(repoBaseDir));","typeGuard":null,"tryCatchPattern":"try {\n  repo.saveRepositoryDirectory(dir);\n} catch (KettleException e) {\n  log.error(\"Could not save directory [\" + dir + \"]: \" + e.getCause(), e);\n  // fall back to re-creating parent chain or aborting the batch\n}","preventionTips":["Validate repo base directory health before directory operations","Avoid OS-illegal characters in directory names","Reconnect if the underlying filesystem moved mid-session"],"tags":["kettle","file-repository","directory","vfs"],"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"}