{"record":{"id":"ce5dcf2d3c304cae","repo":"pentaho/pentaho-kettle","slug":"error-0003-unable-to-delete-users","errorCode":"ERROR_0003_UNABLE_TO_DELETE_USERS","errorMessage":"UserRoleDelegate.ERROR_0003_UNABLE_TO_DELETE_USERS","messagePattern":"UserRoleDelegate\\.ERROR_0003_UNABLE_TO_DELETE_USERS","errorType":"error_code","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/UserRoleDelegate.java","lineNumber":228,"sourceCode":"  private KettleException userExistsException() {\n    return new KettleException( BaseMessages.getString( UserRoleDelegate.class,\n        \"UserRoleDelegate.ERROR_0015_USER_NAME_ALREADY_EXISTS\" ) );\n  }\n\n  private KettleException cannotCreateUserException( IUser user, Exception e ) {\n    return new KettleException( BaseMessages.getString( UserRoleDelegate.class,\n        \"UserRoleDelegate.ERROR_0002_UNABLE_TO_CREATE_USER\", user.getName() ), e );\n  }\n\n  public void deleteUsers( List<IUser> users ) throws KettleException {\n    ensureHasPermissions();\n\n    try {\n      userRoleWebService.deleteUsers( UserRoleHelper.convertToPentahoProxyUsers( users ) );\n      lookupCache.removeUsersFromLookupSet( users );\n      fireUserRoleListChange();\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( UserRoleDelegate.class,\n          \"UserRoleDelegate.ERROR_0003_UNABLE_TO_DELETE_USERS\", e.getLocalizedMessage() ), e ); //$NON-NLS-1$\n    }\n  }\n\n  public void deleteUser( String name ) throws KettleException {\n    ensureHasPermissions();\n\n    try {\n      ProxyPentahoUser user = userRoleWebService.getUser( name );\n      if ( user != null ) {\n        ProxyPentahoUser[] users = new ProxyPentahoUser[1];\n        users[0] = user;\n        userRoleWebService.deleteUsers( users );\n        fireUserRoleListChange();\n      } else {\n        throw new KettleException( BaseMessages.getString( UserRoleDelegate.class,\n            \"UserRoleDelegate.ERROR_0004_UNABLE_TO_DELETE_USER\", name ) ); //$NON-NLS-1$\n      }","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/UserRoleDelegate.java#L210-L246","documentation":"Thrown by UserRoleDelegate.deleteUsers when one or more users cannot be deleted through the Pentaho user-role web service. The delegate calls userRoleWebService.deleteUsers and wraps any resulting exception in a KettleException with message key ERROR_0003_UNABLE_TO_DELETE_USERS, appending the server's localized message. It indicates the remote Pentaho server refused or failed the batch delete.","triggerScenarios":"Calling deleteUsers(List<IUser>) when the underlying userRoleWebService.deleteUsers(ProxyPentahoUser[]) throws: server unreachable, insufficient permissions to administer users (ensureHasPermissions passed but server-side admin role missing), a user in the batch is referenced by roles/lockers, or SOAP transport errors.","commonSituations":"Deleting users from a Pentaho Enterprise Repository via Spoon/kettle while the BI server rejects the deletion (user still assigned to roles, tenant restrictions, admin user deletion attempt), or network/auth failures between client and server (expired session, wrong security provider config).","solutions":["Check the wrapped cause (e.getLocalizedMessage()) to see the server's actual rejection reason.","Verify the connected user has the Administrator security role on the Pentaho server.","Unassign users from roles/permissions before deleting them.","Confirm connectivity and valid login to the Pentaho server (re-login to the repository)."],"exampleFix":"// before\nuserRoleDelegate.deleteUsers(users); // fails if users are assigned to roles\n// after\nfor (IUser user : users) {\n  ((IEEUser) user).setRoles(new ArrayList<IRole>());\n  userRoleDelegate.updateUser(user); // unassign roles first\n}\nuserRoleDelegate.deleteUsers(users);","handlingStrategy":"try-catch","validationCode":"boolean deletable = users.stream().allMatch(u -> {\n  try { return userRoleDelegate.getUser(u.getLogin()) != null; }\n  catch (KettleException e) { return false; }\n});","typeGuard":null,"tryCatchPattern":"try {\n  userRoleDelegate.deleteUsers(users);\n} catch (KettleException e) {\n  log.error(\"Batch user delete failed: \" + e.getCause().getLocalizedMessage(), e);\n  // retry individually to isolate the offending user\n  for (IUser u : users) { try { userRoleDelegate.deleteUser(u.getLogin()); } catch (KettleException ignored) {} }\n}","preventionTips":["Unassign roles/permissions from users before deleting.","Confirm admin rights on the Pentaho server before batch operations.","Test against the correct repository/tenant.","Keep the server session alive during long batch operations."],"tags":["pentaho","user-management","webservice","kettle"],"backgroundTag":"api-error-response","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"}