pentaho/pentaho-kettle · error · RuntimeException

Setting a directory on a database connection is not…

Error message

Setting a directory on a database connection is not supported

What it means

SlaveServer implements RepositoryElementInterface, which requires a repository directory attribute, but a slave server is not a repository element — its getRepositoryDirectory always returns a fresh empty RepositoryDirectory. Calling setRepositoryDirectory is therefore a programming error and throws an UnsupportedOperationException-style RuntimeException.

Solutions

  1. Do not call setRepositoryDirectory on SlaveServer objects
  2. Guard with an instanceof/capability check before assigning a directory
  3. If a directory-like notion is needed for slaves, model it in your own code, not via this API

Example fix

// before: setting directory unconditionally
repositoryElement.setRepositoryDirectory(directory);
// after: only set for actual repository elements
if (!(repositoryElement instanceof SlaveServer)) { repositoryElement.setRepositoryDirectory(directory); }
Defensive patterns

Strategy: type-guard

Validate before calling

// Guard before mutating repository element properties
if (element instanceof SlaveServer) { return; // skip directory assignment
}

Type guard

boolean supportsDirectory(Object element) { return !(element instanceof SlaveServer); }

Try / catch

try { element.setRepositoryDirectory(dir); }
catch (RuntimeException e) { if (e.getMessage().contains("not supported")) { log.warn("Skipped directory set on " + element.getClass().getSimpleName()); return; } throw e; }

Prevention

When it happens

Trigger: Code that generically handles RepositoryElementInterface objects (e.g. repository import/export or generic save logic) calls setRepositoryDirectory on a SlaveServer instance.

Common situations: Generic metadata-processing code that sets directories on all repository elements without checking the element type; migration/import scripts treating slave servers as repo objects.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/cluster/SlaveServer.java:1270

      lock.readLock().unlock();
    }
  }

  public void setObjectId( ObjectId id ) {
    lock.writeLock().lock();
    this.id = id;
    lock.writeLock().unlock();
  }

  /**
   * Not used in this case, simply return root /
   */
  public RepositoryDirectoryInterface getRepositoryDirectory() {
    return new RepositoryDirectory();
  }

  public void setRepositoryDirectory( RepositoryDirectoryInterface repositoryDirectory ) {
    throw new RuntimeException( "Setting a directory on a database connection is not supported" );
  }

  public RepositoryObjectType getRepositoryElementType() {
    return REPOSITORY_ELEMENT_TYPE;
  }

  public ObjectRevision getObjectRevision() {
    lock.readLock().lock();
    try {
      return objectRevision;
    } finally {
      lock.readLock().unlock();
    }
  }

  public void setObjectRevision( ObjectRevision objectRevision ) {
    lock.writeLock().lock();
    this.objectRevision = objectRevision;

View on GitHub (pinned to f3058517a1)