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'

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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

Problem

When a user from LDAP is added to a project role , it fails 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'

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

The following appears in the XXXXXXXXXXX.log

 
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

    SELECT
        lower_user_name
    FROM
        cwd_user
    WHERE
        lower_user_name NOT IN (
            SELECT lower_user_name FROM app_user
    );

    (info) If the query above does not work for some database use this one instead :

    SELECT
        lower_user_name
    FROM
        cwd_user
    WHERE
        BINARY lower_user_name NOT IN (
            SELECT BINARY lower_user_name FROM app_user
    );


    Second Query

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

    (info) 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)

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

    (info) 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. 
    (info) 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

Resolution

  1. Backup JIRA
  2. Run this SQL query to fix this issue:

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

    (info) 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:

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

    (info) Replace XXXXX with the affected username.

  4. Restart JIRA


Last modified on Jun 2, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.