{"record":{"id":"0ed0dc1b6a2dea52","repo":"pentaho/pentaho-kettle","slug":"error-0004-unable-to-delete-user","errorCode":"ERROR_0004_UNABLE_TO_DELETE_USER","errorMessage":"UserRoleDelegate.ERROR_0004_UNABLE_TO_DELETE_USER","messagePattern":"UserRoleDelegate\\.ERROR_0004_UNABLE_TO_DELETE_USER","errorType":"error_code","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/UserRoleDelegate.java","lineNumber":244,"sourceCode":"      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      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( UserRoleDelegate.class,\n          \"UserRoleDelegate.ERROR_0004_UNABLE_TO_DELETE_USER\", name ), e ); //$NON-NLS-1$\n    }\n  }\n\n  public void setUsers( List<IUser> users ) throws KettleException {\n    // TODO Figure out what to do here\n  }\n\n  public IUser getUser( String name, String password ) throws KettleException {\n    ensureHasPermissions();\n\n    IUser userInfo = null;\n    try {\n      ProxyPentahoUser user = userRoleWebService.getUser( name );","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/UserRoleDelegate.java#L226-L262","documentation":"Thrown by UserRoleDelegate.deleteUser(String) when the named user cannot be found, so no ProxyPentahoUser can be constructed and the delete call is never made. It is raised in the explicit `user == null` branch: lookupUser returned nothing for the given name. Message key ERROR_0004_UNABLE_TO_DELETE_USER includes the user name.","triggerScenarios":"Calling deleteUser(name) where the name does not exist in the Pentaho security database (lookupUser returned null), i.e. a plain misspelling, a deleted user, or a user living in a different tenant/workspace.","commonSituations":"Scripts cleaning up users after a stale metadata export; case-sensitivity mismatches ('Admin' vs 'admin'); connecting to a different repository than the one the user list came from.","solutions":["Verify the user name exists via getUsers() or the Pentaho User Console before deleting.","Check name spelling and case against the server's list.","Ensure you are connected to the intended Pentaho repository/tenant."],"exampleFix":"// before\nuserRoleDelegate.deleteUser(\"jdoe\"); // fails if jdoe doesn't exist\n// after\nif (userRoleDelegate.getUser(\"jdoe\") != null) {\n  userRoleDelegate.deleteUser(\"jdoe\");\n}","handlingStrategy":"validation","validationCode":"boolean exists = userRoleDelegate.getUsers().stream()\n    .anyMatch(u -> u.getLogin().equals(name));\nif (!exists) { log.warn(\"User \" + name + \" not found; skipping delete\"); return; }","typeGuard":null,"tryCatchPattern":"try {\n  userRoleDelegate.deleteUser(name);\n} catch (KettleException e) {\n  if (e.getCause() == null) { log.warn(\"User not found: \" + name); }\n}","preventionTips":["Always resolve the user via getUser()/getUsers() before deleting.","Compare names case-sensitively as the server stores them.","Confirm the active repository connection matches where the user lives."],"tags":["pentaho","user-management","user-not-found"],"backgroundTag":"user-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"}