pentaho/pentaho-kettle · error · KettleException

ERROR_0010_UNABLE_TO_GET_ROLE

ERROR_0010_UNABLE_TO_GET_ROLE

Error message

UserRoleDelegate.ERROR_0010_UNABLE_TO_GET_ROLE

What it means

Thrown by UserRoleDelegate.getRole(String name) when fetching a single role fails. After ensureHasPermissions(), the delegate resolves the role via UserRoleHelper.getProxyPentahoRole and converts it; any exception in that chain is wrapped in a KettleException with ERROR_0010_UNABLE_TO_GET_ROLE and the role name. A non-existent role typically surfaces here as an exception from the web service rather than a null return.

Solutions

  1. Verify the role name exists via getRoles() before fetching.
  2. Check spelling/case of the role name.
  3. Inspect the cause for the server-side message.
  4. Confirm admin permissions on the server for security reads.

Example fix

// before
IRole role = userRoleDelegate.getRole("Editor");
// after
IRole role = userRoleDelegate.getRoles().stream()
    .filter(r -> r.getName().equalsIgnoreCase("Editor"))
    .findFirst().orElse(null); // avoids the exception path
Defensive patterns

Strategy: validation

Validate before calling

IRole found = userRoleDelegate.getRoles().stream()
    .filter(r -> r.getName().equals(name)).findFirst().orElse(null);
if (found == null) { log.warn("Role not found: " + name); return; }

Try / catch

try {
  IRole role = userRoleDelegate.getRole(name);
} catch (KettleException e) {
  Throwable cause = e.getCause();
  log.error("Role fetch of " + name + " failed: " + (cause != null ? cause.getLocalizedMessage() : ""), e);
}

Prevention

When it happens

Trigger: Calling getRole(name) when the role doesn't exist (web service throws instead of returning null), the session is invalid, the client lacks permissions despite ensureHasPermissions passing locally, or conversion (roles-for-role lookup) fails.

Common situations: Scripts referencing roles by a misspelled or case-mismatched name; role renamed on the server; querying an LDAP-backed role that isn't exposed through the web service.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/UserRoleDelegate.java:390

    try {
      userRoleWebService.deleteRoles( UserRoleHelper.convertToPentahoProxyRoles( roles ) );
      lookupCache.removeRolesFromLookupSet( roles );
      fireUserRoleListChange();
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString( UserRoleDelegate.class,
          "UserRoleDelegate.ERROR_0009_UNABLE_TO_DELETE_ROLES" ), e ); //$NON-NLS-1$
    }
  }

  public IRole getRole( String name ) throws KettleException {
    ensureHasPermissions();

    try {
      return UserRoleHelper.convertFromProxyPentahoRole( userRoleWebService, UserRoleHelper.getProxyPentahoRole(
          userRoleWebService, name ), lookupCache, rsm );
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString( UserRoleDelegate.class,
          "UserRoleDelegate.ERROR_0010_UNABLE_TO_GET_ROLE", name ), e ); //$NON-NLS-1$
    }
  }

  public List<IRole> getRoles() throws KettleException {
    try {
      if ( hasNecessaryPermissions ) {
        return UserRoleHelper.convertToListFromProxyPentahoRoles( userRoleSecurityInfo, rsm );
      } else {
        return UserRoleHelper.convertToListFromNonPentahoRoles( userRoleInfo, rsm );
      }
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString( UserRoleDelegate.class,
          "UserRoleDelegate.ERROR_0011_UNABLE_TO_GET_ROLES" ), e ); //$NON-NLS-1$
    }
  }

  public List<IRole> getDefaultRoles() throws KettleException {

View on GitHub (pinned to f3058517a1)