{"record":{"id":"b62fe5ecb320d174","repo":"pentaho/pentaho-kettle","slug":"error-0013-unable-to-delete-role","errorCode":"ERROR_0013_UNABLE_TO_DELETE_ROLE","errorMessage":"UserRoleDelegate.ERROR_0013_UNABLE_TO_DELETE_ROLE","messagePattern":"UserRoleDelegate\\.ERROR_0013_UNABLE_TO_DELETE_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":447,"sourceCode":"      fireUserRoleListChange();\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( UserRoleDelegate.class,\n          \"UserRoleDelegate.ERROR_0012_UNABLE_TO_UPDATE_ROLE\", role.getName() ), e ); //$NON-NLS-1$\n    }\n  }\n\n  public void deleteRole( String name ) throws KettleException {\n    ensureHasPermissions();\n\n    try {\n      ProxyPentahoRole roleToDelete = UserRoleHelper.getProxyPentahoRole( userRoleWebService, name );\n      if ( roleToDelete != null ) {\n        ProxyPentahoRole[] roleArray = new ProxyPentahoRole[1];\n        roleArray[0] = roleToDelete;\n        userRoleWebService.deleteRoles( roleArray );\n        fireUserRoleListChange();\n      } else {\n        throw new KettleException( BaseMessages.getString( UserRoleDelegate.class,\n            \"UserRoleDelegate.ERROR_0013_UNABLE_TO_DELETE_ROLE\", name ) ); //$NON-NLS-1$\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( UserRoleDelegate.class,\n          \"UserRoleDelegate.ERROR_0013_UNABLE_TO_DELETE_ROLE\", name ), e ); //$NON-NLS-1$\n    }\n  }\n\n  public void setRoles( List<IRole> roles ) throws KettleException {\n    // TODO Figure out what to do here\n  }\n\n  public void addUserRoleListChangeListener( IUserRoleListChangeListener listener ) {\n    if ( userRoleListChangeListeners == null ) {\n      userRoleListChangeListeners = new UserRoleListChangeListenerCollection();\n    }\n    userRoleListChangeListeners.add( listener );\n  }","sourceCodeStart":429,"sourceCodeEnd":465,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/UserRoleDelegate.java#L429-L465","documentation":"Second throw site of UserRoleDelegate.deleteRole(): thrown when the role exists (roleToDelete found) but the deleteRoles web-service call fails. The original lookup-miss throw at line 447 and this wrap share the same message key ERROR_0013_UNABLE_TO_DELETE_ROLE with the role name as parameter.","triggerScenarios":"Role was found locally, but userRoleWebService.deleteRoles throws — server-side delete refused (permissions, session expired, concurrent deletion, network failure).","commonSituations":"Another admin deleted the role between lookup and delete; non-admin user; server connection dropped; server refuses to delete a system/last-admin role.","solutions":["Inspect the cause for the web-service error","Re-list roles to confirm the role still exists on the server","Verify admin permissions for the connected user","Reconnect if the session expired","Check server logs for refusal reasons (system role, last admin role)"],"exampleFix":"// before\nroleDelegate.deleteRole( \"Analyst\" );\n// after\ntry {\n  roleDelegate.deleteRole( \"Analyst\" );\n} catch ( KettleException e ) {\n  logError( \"Delete failed\", e );\n}","handlingStrategy":"try-catch","validationCode":"IRole toDelete = delegate.findRole( name ); // non-null before deleting","typeGuard":null,"tryCatchPattern":"try { delegate.deleteRole( name ); } catch ( KettleException e ) { if ( e.getCause() != null ) logError( \"Server refused delete\", e.getCause() ); }","preventionTips":["Refresh role lists immediately before delete to reduce race windows","Check server logs when deletes are refused","Use an admin account"],"tags":["kettle","pentaho","roles","web-service"],"backgroundTag":"api-request-failed","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"}