{"record":{"id":"2fa6f2748df2a5a3","repo":"pentaho/pentaho-kettle","slug":"error-0010-unable-to-get-role","errorCode":"ERROR_0010_UNABLE_TO_GET_ROLE","errorMessage":"UserRoleDelegate.ERROR_0010_UNABLE_TO_GET_ROLE","messagePattern":"UserRoleDelegate\\.ERROR_0010_UNABLE_TO_GET_ROLE","errorType":"error_code","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/UserRoleDelegate.java","lineNumber":390,"sourceCode":"\n    try {\n      userRoleWebService.deleteRoles( UserRoleHelper.convertToPentahoProxyRoles( roles ) );\n      lookupCache.removeRolesFromLookupSet( roles );\n      fireUserRoleListChange();\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( UserRoleDelegate.class,\n          \"UserRoleDelegate.ERROR_0009_UNABLE_TO_DELETE_ROLES\" ), e ); //$NON-NLS-1$\n    }\n  }\n\n  public IRole getRole( String name ) throws KettleException {\n    ensureHasPermissions();\n\n    try {\n      return UserRoleHelper.convertFromProxyPentahoRole( userRoleWebService, UserRoleHelper.getProxyPentahoRole(\n          userRoleWebService, name ), lookupCache, rsm );\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( UserRoleDelegate.class,\n          \"UserRoleDelegate.ERROR_0010_UNABLE_TO_GET_ROLE\", name ), e ); //$NON-NLS-1$\n    }\n  }\n\n  public List<IRole> getRoles() throws KettleException {\n    try {\n      if ( hasNecessaryPermissions ) {\n        return UserRoleHelper.convertToListFromProxyPentahoRoles( userRoleSecurityInfo, rsm );\n      } else {\n        return UserRoleHelper.convertToListFromNonPentahoRoles( userRoleInfo, rsm );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( UserRoleDelegate.class,\n          \"UserRoleDelegate.ERROR_0011_UNABLE_TO_GET_ROLES\" ), e ); //$NON-NLS-1$\n    }\n  }\n\n  public List<IRole> getDefaultRoles() throws KettleException {","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/UserRoleDelegate.java#L372-L408","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the role name exists via getRoles() before fetching.","Check spelling/case of the role name.","Inspect the cause for the server-side message.","Confirm admin permissions on the server for security reads."],"exampleFix":"// before\nIRole role = userRoleDelegate.getRole(\"Editor\");\n// after\nIRole role = userRoleDelegate.getRoles().stream()\n    .filter(r -> r.getName().equalsIgnoreCase(\"Editor\"))\n    .findFirst().orElse(null); // avoids the exception path","handlingStrategy":"validation","validationCode":"IRole found = userRoleDelegate.getRoles().stream()\n    .filter(r -> r.getName().equals(name)).findFirst().orElse(null);\nif (found == null) { log.warn(\"Role not found: \" + name); return; }","typeGuard":null,"tryCatchPattern":"try {\n  IRole role = userRoleDelegate.getRole(name);\n} catch (KettleException e) {\n  Throwable cause = e.getCause();\n  log.error(\"Role fetch of \" + name + \" failed: \" + (cause != null ? cause.getLocalizedMessage() : \"\"), e);\n}","preventionTips":["Validate role names against getRoles() before direct fetch.","Match name case exactly as returned by the server.","Re-check permissions if ensureHasPermissions keeps passing but fetches fail."],"tags":["pentaho","role-management","webservice"],"backgroundTag":"entity-not-found","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"}