pentaho/pentaho-kettle · error · KettleException

Unable to create folder + newFolder

Error message

Unable to create folder + newFolder

What it means

Thrown when KettleFileRepository.createRepositoryDirectory() fails to physically create the folder for the new repository directory via Apache Commons VFS (FileSystemException). The repository directory object is only created in memory after the folder is successfully created, so this error means nothing was changed.

Solutions

  1. Read the chained FileSystemException for the concrete reason (exists-as-file, access denied, etc.).
  2. Check no file already occupies the target folder path and remove/rename it.
  3. Verify the process has write permission on the parent directory.
  4. Sanitize the directory name — strip filesystem-illegal characters before creating.

Example fix

// before
repo.createRepositoryDirectory(parentDir, "new:folder"); // ':' illegal on Windows

// after
String safe = directoryPath.replaceAll("[\\/:*?\"<>|]", "_");
repo.createRepositoryDirectory(parentDir, safe);
Defensive patterns

Strategy: validation

Validate before calling

// sanitize name and check parent writability before creating
String safe = path.replaceAll("[\\/:*?\"<>|]", "_");
boolean ok = new File(parentPath).canWrite();

Try / catch

try {
  repo.createRepositoryDirectory(parentDir, path);
} catch (KettleException e) {
  if (e.getCause() instanceof FileSystemException) {
    log.error("VFS folder creation failed: " + e.getCause().getMessage());
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling createRepositoryDirectory(parentDirectory, directoryPath) when the target path already exists as a file, the parent is unwritable, the path contains illegal characters, or the VFS scheme is invalid/unreachable.

Common situations: Creating directories in a file repo on a network share with permission issues; a file already occupying the target name; path segments with characters invalid on the OS filesystem; misconfigured repo base URL.

Understand the failure class

Background: mkdir permission denied (EACCES): failed to create directory errors explained — this error's family across 32 libraries.

Related errors


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

Appendix: source

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

    }
  }

  @Override
  public RepositoryDirectoryInterface createRepositoryDirectory( RepositoryDirectoryInterface parentDirectory,
    String directoryPath ) throws KettleException {
    String folder = calcDirectoryName( parentDirectory );
    String newFolder = folder;
    if ( folder.endsWith( "/" ) ) {
      newFolder += directoryPath;
    } else {
      newFolder += "/" + directoryPath;
    }

    FileObject parent = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( newFolder );
    try {
      parent.createFolder();
    } catch ( FileSystemException e ) {
      throw new KettleException( "Unable to create folder " + newFolder, e );
    }

    // Incremental change of the directory structure...
    //
    RepositoryDirectory newDir = new RepositoryDirectory( parentDirectory, directoryPath );
    parentDirectory.addSubdirectory( newDir );
    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 );

View on GitHub (pinned to f3058517a1)