pentaho/pentaho-kettle · error · KettleException

Unable to save directory [ + dir + ] in the repository

Error message

Unable to save directory [ + dir + ] in the repository

What it means

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.

Solutions

  1. Examine the chained cause to determine the exact VFS/IO failure.
  2. Ensure the repository base directory exists and is writable before saving directories.
  3. Check the directory name for OS-illegal characters and rename it.
  4. Reconnect/refresh the repository if the underlying filesystem location changed mid-session.

Example fix

// before: saving into a moved repo base
repo.saveRepositoryDirectory(dir);

// after: verify base dir is live and writable first
if (!Files.isDirectory(Paths.get(repoBaseDir)) || !Files.isWritable(Paths.get(repoBaseDir))) {
  throw new IllegalStateException("Invalid repository base: " + repoBaseDir);
}
repo.saveRepositoryDirectory(dir);
Defensive patterns

Strategy: try-catch

Validate before calling

boolean baseOk = Files.isDirectory(Paths.get(repoBaseDir)) && Files.isWritable(Paths.get(repoBaseDir));

Try / catch

try {
  repo.saveRepositoryDirectory(dir);
} catch (KettleException e) {
  log.error("Could not save directory [" + dir + "]: " + e.getCause(), e);
  // fall back to re-creating parent chain or aborting the batch
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/85977a2ea15e7f72. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/repository/filerep/KettleFileRepository.java:392

    newDir.setObjectId( new StringObjectId( calcObjectId( newDir ) ) );

    return newDir;
  }

  @Override
  public void saveRepositoryDirectory( RepositoryDirectoryInterface dir ) throws KettleException {
    try {
      String filename = calcDirectoryName( dir );
      ObjectId objectId = new StringObjectId( calcRelativeElementDirectory( dir ) );

      FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename );
      fileObject.createFolder(); // also create parents

      dir.setObjectId( objectId );

      log.logDetailed( "New id of directory = " + dir.getObjectId() );
    } catch ( Exception e ) {
      throw new KettleException( "Unable to save directory [" + dir + "] in the repository", e );
    }
  }

  private void delObject( ObjectId id ) throws KettleException {
    String filename = calcFilename( id );
    deleteFile( filename );
  }

  @Override
  public void deleteJob( ObjectId id_job ) throws KettleException {
    delObject( id_job );
  }

  @Override
  public void deleteTransformation( ObjectId id_transformation ) throws KettleException {
    delObject( id_transformation );
  }

View on GitHub (pinned to f3058517a1)