Unable to add user to project role with the error The actor: 'xxx ' could not be found in any user directory. Therefore, it is not possible to add it to the project role: 'xxxxxx'

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Problem

When a user from LDAP is added to a project role , it fails with the error

1 The actor: 'xxx ' could not be found in any user directory. Therefore, it is not possible to add it to the project role: 'xxxxxx'
(Auto-migrated image: description temporarily unavailable)

There is a noticeable blank space, trailing space shown in the error message after the username.

The following appears in the XXXXXXXXXXX.log

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16   2015-11-17 14:17:58,254 http-bio-443-exec-130 ERROR jiraadmin 857x203035x1 yg7mrm 172.20.116.52 /secure/admin/user/ViewUserProjectRoles!default.jspa [jira.security.roles.OfBizProjectRoleAndActorStore] Unable to find user with name: gerb 2015-11-17 14:17:58,255 http-bio-443-exec-130 ERROR jiraadmin 857x203035x1 yg7mrm 172.20.116.52 /secure/admin/user/ViewUserProjectRoles!default.jspa [webwork.util.ValueStack] query="/visibleProjectsByCategory/size" {[id="null" type="5" values=""]} {[id="visibleProjectsByCategory" type="8" values=""]} {[id="size" type="8" values=""]} java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor4156.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at webwork.util.InjectionUtils$DefaultInjectionImpl.invoke(InjectionUtils.java:70) at webwork.util.InjectionUtils.invoke(InjectionUtils.java:56) ... Caused by: java.lang.IllegalArgumentException: Unable to find user with name: gerb at com.atlassian.jira.security.roles.OfBizProjectRoleAndActorStore.getProjectIdsForUserInGroupsBecauseOfRole(OfBizProjectRoleAndActorStore.java:374) at com.atlassian.jira.security.roles.CachingProjectRoleAndActorStore.getProjectIdsForUserInGroupsBecauseOfRole(CachingProjectRoleAndActorStore.java:204) at com.atlassian.jira.security.roles.DefaultProjectRoleManager.getProjectIdsForUserInGroupsBecauseOfRole(DefaultProjectRoleManager.java:272) at com.atlassian.jira.bc.projectroles.DefaultProjectRoleService.getProjectIdsForUserInGroupsBecauseOfRole(DefaultProjectRoleService.java:839)

Diagnosis

Diagnostic Steps

  • Run the following 2 queries to further investigate the trailing space / blank space from the database

    First query

    1 2 3 4 5 6 7 8 SELECT lower_user_name FROM cwd_user WHERE lower_user_name NOT IN ( SELECT lower_user_name FROM app_user );

    ℹ️ If the query above does not work for some database use this one instead :

    1 2 3 4 5 6 7 8 SELECT lower_user_name FROM cwd_user WHERE BINARY lower_user_name NOT IN ( SELECT BINARY lower_user_name FROM app_user );

    Second Query

    1 SELECT * FROM app_user WHERE lower_user_name = 'XXXXXX ' OR user_key = 'XXXXX ';

    ℹ️ Replace XXXXX with the affected username and make sure to include the space after XXXXX for the lower_user_name and user_key.

    Third Query (work for Postgres only)

    1 SELECT char_length(user_key), char_length(lower_user_name) FROM app_user WHERE lower_user_name = 'XXXXX';

    ℹ️ Replace XXXXX with the affected username and noticed the character length from user_key and lower_user_name is different so means is not correct. Check which one is the right username lengths and proceed with the resolution below.

    ℹ️ If you are using other then Postgres database, please adjust the SQL query to the same functions here.

Cause

From the query, we can confirm that there is a trailing/leading space in the app_user table which needs to be manually updated

Solution

Resolution

  1. Backup JIRA

  2. Run this SQL query to fix this issue:

    1 2 3 UPDATE app_user SET lower_user_name = 'XXXXX', user_key = 'XXXXX' WHERE lower_user_name = 'XXXXX 'OR user_key = 'XXXXX ';

    ℹ️Replace XXXXX with the affected username and noticed the space after XXXXX for the lower_user_name and user_key for the last line

  3. (For third query only) Run the SQL query below:

    1 update app_user set user_key = 'XXXXX' where lower_user_name = 'XXXXX';

    ℹ️ Replace XXXXX with the affected username.

  4. Restart JIRA

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.