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

UserInfo (a repository user modelled as a repository element) implements setRepositoryDirectory only to reject the call. Users are global account records, not per-directory objects, so assigning a repository directory to a UserInfo is intentionally unsupported and throws an immediate RuntimeException.

Solutions

  1. Remove the setRepositoryDirectory call for UserInfo objects; users are not directory-scoped.
  2. Type-check the element before assigning a directory (only call on elements that actually support it).
  3. If you need directory-scoped security, use folder-level repository security features rather than per-user directories.

Example fix

// before
userInfo.setRepositoryDirectory(directory); // throws

// after
if (!(element instanceof UserInfo)) {
  element.setRepositoryDirectory(directory);
}
Defensive patterns

Strategy: type-guard

Validate before calling

if (element instanceof UserInfo) { /* skip directory assignment */ }

Type guard

boolean supportsDirectory(RepositoryElementInterface e) {
  return !(e instanceof UserInfo);
}

Try / catch

try {
  element.setRepositoryDirectory(dir);
} catch (RuntimeException e) {
  if (e.getMessage().contains("not supported")) {
    log.debug("Element does not support directories: " + element.getClass().getSimpleName());
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling userInfo.setRepositoryDirectory(dir) directly, or generic repository code that assigns a directory to any RepositoryElementInterface it processes (e.g. during export/import or repository sync loops that include user objects).

Common situations: Generic code iterating over shared/repository elements and calling setRepositoryDirectory on each; migrating users via the same path used for transformations/jobs; misusing UserInfo as a directory-scoped element.

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/d298f0044cad3915. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/repository/UserInfo.java:141

    this.id = id;
  }

  /**
   * @return the enabled
   */
  public boolean isEnabled() {
    return enabled;
  }

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

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

  public String getRepositoryElementType() {
    return REPOSITORY_ELEMENT_TYPE;
  }

  /**
   * The name of the user maps to the login id
   */
  public String getName() {
    return login;
  }

  /**
   * Set the name of the user.
   *
   * @param name
   *          The name of the user maps to the login id.

View on GitHub (pinned to f3058517a1)