pentaho/pentaho-kettle · error · KettleException

Could not find folder [ + id + ]

Error message

Could not find folder [ + id + ]

What it means

KettleFileRepository.renameRepositoryObject() (directory branch) throws this KettleException when loadRepositoryDirectoryTree().findDirectory(id) returns null, i.e. the given ObjectId does not correspond to any folder in the repository directory tree.

Solutions

  1. Reload the repository directory tree and verify the directory exists before renaming
  2. Check that the id passed is a valid directory ObjectId (root-relative path) rather than an object id
  3. Refresh/reopen the repository to discard stale cached ids
  4. Handle the KettleException and surface 'folder not found' to the user instead of retrying

Example fix

// before
repo.renameRepositoryObject(oldDirId, null, "new-name"); // oldDirId may be stale
// after
RepositoryDirectoryInterface dir = repo.loadRepositoryDirectoryTree().findDirectory("/old");
if (dir != null) {
  repo.renameRepositoryObject(dir.getObjectId(), null, "new-name");
}
Defensive patterns

Strategy: validation

Validate before calling

RepositoryDirectoryInterface dir = repo.loadRepositoryDirectoryTree().findDirectory(idPath);
if (dir == null) {
  throw new IllegalArgumentException("Folder not found: " + idPath);
}

Try / catch

try {
  repo.renameRepositoryObject(dirId, null, newName);
} catch (KettleException e) {
  if (e.getMessage().contains("Could not find folder")) {
    log.warn("Directory vanished; refreshing tree");
  }
}

Prevention

When it happens

Trigger: Renaming a directory using an ObjectId that is not present in the freshly loaded directory tree - typically a stale/deleted directory id or a malformed path string used as the id.

Common situations: Directory was deleted or moved by another client before the rename; caller passed a raw filename instead of a valid directory ObjectId; cached directory ids used after the repository tree changed.

Related errors


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

Appendix: source

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

  public ObjectId renameJob( ObjectId id_job, String versionComment, RepositoryDirectoryInterface newDir,
    String newName ) throws KettleException {
    ObjectId objectId = renameObject( id_job, newDir, newName, EXT_JOB );
    if ( !Utils.isEmpty( versionComment ) ) {
      insertLogEntry( "Rename job : " + versionComment );
    }
    return objectId;
  }

  @Override
  public ObjectId renameRepositoryDirectory( ObjectId id, RepositoryDirectoryInterface newParentDir, String newName ) throws KettleException {
    if ( newParentDir != null || newName != null ) {
      try {
        // In case of a root object, the ID is the same as the relative filename...
        RepositoryDirectoryInterface tree = loadRepositoryDirectoryTree();
        RepositoryDirectoryInterface dir = tree.findDirectory( id );

        if ( dir == null ) {
          throw new KettleException( "Could not find folder [" + id + "]" );
        }

        // If newName is null, keep the current name
        newName = ( newName != null ) ? newName : dir.getName();

        FileObject folder = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( dir.getPath() );

        String newFolderName = null;

        if ( newParentDir != null ) {
          FileObject newParentFolder = KettleVFS.getInstance( DefaultBowl.getInstance() )
            .getFileObject( newParentDir.getPath() );

          newFolderName = newParentFolder.toString() + "/" + newName;
        } else {
          newFolderName = folder.getParent().toString() + "/" + newName;
        }

View on GitHub (pinned to f3058517a1)