{"record":{"id":"f885ab9a3b728530","repo":"pentaho/pentaho-kettle","slug":"kettledatabaserepositorysecurityprovider-error-0001-unable","errorCode":"KettleDatabaseRepositorySecurityProvider.ERROR_0001_UNABLE_TO_CREATE_USER","errorMessage":"KettleDatabaseRepositorySecurityProvider.ERROR_0001_UNABLE_TO_CREATE_USER","messagePattern":"KettleDatabaseRepositorySecurityProvider\\.ERROR_0001_UNABLE_TO_CREATE_USER","errorType":"error_code","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/kdr/KettleDatabaseRepositorySecurityProvider.java","lineNumber":98,"sourceCode":"\n  // UserInfo\n\n  public IUser loadUserInfo( String login ) throws KettleException {\n    return userDelegate.loadUserInfo( new UserInfo(), login );\n  }\n\n  /**\n   * This method creates new user after all validations have been done. For updating user's data please use {@linkplain\n   * #updateUser(IUser)}.\n   *\n   * @param userInfo user's info\n   * @throws KettleException\n   * @throws IllegalArgumentException if {@code userInfo.getObjectId() != null}\n   */\n  public void saveUserInfo( IUser userInfo ) throws KettleException {\n    normalizeUserInfo( userInfo );\n    if ( !validateUserInfo( userInfo ) ) {\n      throw new KettleException( BaseMessages.getString( KettleDatabaseRepositorySecurityProvider.class,\n        \"KettleDatabaseRepositorySecurityProvider.ERROR_0001_UNABLE_TO_CREATE_USER\" ) );\n    }\n\n    if ( userInfo.getObjectId() != null ) {\n      // not a message for UI\n      throw new IllegalArgumentException( \"Use updateUser() for updating\" );\n    }\n\n    String userLogin = userInfo.getLogin();\n    ObjectId exactMatch = userDelegate.getUserID( userLogin );\n    if ( exactMatch != null ) {\n      // found the corresponding record in db, prohibit creation!\n      throw new KettleException( BaseMessages.getString( KettleDatabaseRepositorySecurityProvider.class,\n        \"KettleDatabaseRepositorySecurityProvider.ERROR_0001_USER_NAME_ALREADY_EXISTS\" ) );\n    }\n\n    userDelegate.saveUserInfo( userInfo );\n  }","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/kdr/KettleDatabaseRepositorySecurityProvider.java#L80-L116","documentation":"KettleDatabaseRepositorySecurityProvider.saveUserInfo() throws a KettleException with the localized ERROR_0001_UNABLE_TO_CREATE_USER message when normalizeUserInfo() passes but validateUserInfo() returns false, i.e. the IUser data failed validation before any insert. Note the message key text is thrown, not a formatted user-facing description.","triggerScenarios":"Calling saveUserInfo(userInfo) with an IUser whose required fields are missing/invalid after normalization (e.g. null/empty login, password, or other mandated fields), or fields exceeding database column limits.","commonSituations":"Programmatic user provisioning via the Kettle security provider with incomplete IUser objects; importing users from LDAP/CSV where some accounts lack login or password; UIless scripts creating users with blank names.","solutions":["Populate all required IUser fields (login, password, etc.) before calling saveUserInfo().","Call validateUserInfo() logic yourself (or replicate checks) and reject invalid users upstream.","Use updateUser() instead when userInfo.getObjectId() != null (that path throws IllegalArgumentException).","Check field lengths against R_USER column sizes to avoid validation failure."],"exampleFix":"// before\nIUser u = new User(); u.setName(null); u.setPassword(\"x\");\nsecurity.saveUserInfo(u); // throws ERROR_0001\n// after\nIUser u = new User();\nu.setName(\"jsmith\"); u.setPassword(\"secret\"); u.addProfile(...);\nif (u.getLogin() != null && !u.getLogin().isEmpty()) {\n  security.saveUserInfo(u);\n}","handlingStrategy":"validation","validationCode":"boolean canSave(IUser u) {\n  return u != null && u.getName() != null && !u.getName().isEmpty()\n      && u.getPassword() != null && !u.getPassword().isEmpty();\n}\nif (!canSave(userInfo)) throw new IllegalArgumentException(\"invalid IUser\");","typeGuard":"boolean isValidUser(IUser u) { return u != null && u.getName() != null && !u.getName().trim().isEmpty() && u.getPassword() != null; }","tryCatchPattern":"try {\n  security.saveUserInfo(userInfo);\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"ERROR_0001_UNABLE_TO_CREATE_USER\")) {\n    // user data failed validation; fix IUser fields\n  }\n}","preventionTips":["Populate login and password before saveUserInfo().","Use updateUser() when the user already has an ObjectId.","Validate field lengths against R_USER columns.","Validate imported users (LDAP/CSV) before provisioning."],"tags":["security","user-validation","repository"],"backgroundTag":"schema-validation-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"}