{"record":{"id":"d298f0044cad3915","repo":"pentaho/pentaho-kettle","slug":"setting-a-directory-on-a-database-connection-is-not-userinfo","errorCode":null,"errorMessage":"Setting a directory on a database connection is not supported","messagePattern":"Setting a directory on a database connection is not supported","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/UserInfo.java","lineNumber":141,"sourceCode":"    this.id = id;\n  }\n\n  /**\n   * @return the enabled\n   */\n  public boolean isEnabled() {\n    return enabled;\n  }\n\n  /**\n   * Not used in this case, simply return root /\n   */\n  public RepositoryDirectory getRepositoryDirectory() {\n    return new RepositoryDirectory();\n  }\n\n  public void setRepositoryDirectory( RepositoryDirectory repositoryDirectory ) {\n    throw new RuntimeException( \"Setting a directory on a database connection is not supported\" );\n  }\n\n  public String getRepositoryElementType() {\n    return REPOSITORY_ELEMENT_TYPE;\n  }\n\n  /**\n   * The name of the user maps to the login id\n   */\n  public String getName() {\n    return login;\n  }\n\n  /**\n   * Set the name of the user.\n   *\n   * @param name\n   *          The name of the user maps to the login id.","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/UserInfo.java#L123-L159","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Remove the setRepositoryDirectory call for UserInfo objects; users are not directory-scoped.","Type-check the element before assigning a directory (only call on elements that actually support it).","If you need directory-scoped security, use folder-level repository security features rather than per-user directories."],"exampleFix":"// before\nuserInfo.setRepositoryDirectory(directory); // throws\n\n// after\nif (!(element instanceof UserInfo)) {\n  element.setRepositoryDirectory(directory);\n}","handlingStrategy":"type-guard","validationCode":"if (element instanceof UserInfo) { /* skip directory assignment */ }","typeGuard":"boolean supportsDirectory(RepositoryElementInterface e) {\n  return !(e instanceof UserInfo);\n}","tryCatchPattern":"try {\n  element.setRepositoryDirectory(dir);\n} catch (RuntimeException e) {\n  if (e.getMessage().contains(\"not supported\")) {\n    log.debug(\"Element does not support directories: \" + element.getClass().getSimpleName());\n  } else { throw e; }\n}","preventionTips":["Never treat UserInfo as a directory-scoped repository element","Type-check elements before generic directory assignment loops","Use repository folder security instead of per-user directories"],"tags":["kettle","unsupported-operation","user-management","runtime-exception"],"backgroundTag":"unsupported-operation","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}