User does not exist error when trying to login, edit or delete a user
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
Symptoms
Logging in, deleting, or editing a user is not possible even though the user exists on the user management tab. Editing the user returns a stack trace in the page, and deleting it results in the following error:
In the below screen "user001" was provisioned but its directory and full name do not exist. Logging in, editing, and deleting this user fails via User Management and API.
In some cases, the following appears in the atlassian-jira.log
:
2013-07-01 17:20:32,465 http-bio-8090-exec-4 ERROR [500ErrorPage.jsp] Exception caught in 500 page null
java.lang.NullPointerException
at com.atlassian.jira.web.action.admin.user.EditUser.buildNewUser(EditUser.java:106)
at com.atlassian.jira.web.action.admin.user.EditUser.doValidation(EditUser.java:57)
at webwork.action.ActionSupport.validate(ActionSupport.java:391)
at webwork.action.ActionSupport.execute(ActionSupport.java:162)
at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:83) <+7> (DefaultInterceptorChain.java:39) (NestedInterceptorChain.java:31) (ChainedInterceptor.java:16) (DefaultInterceptorChain.java:35) (GenericDispatcher.java:225) (GenericDispatcher.java:154) (JiraWebworkActionDispatcher.java:151)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) <+14> (ApplicationFilterChain.java:305) (ApplicationFilterChain.java:210) (ChainedFilterStepRunner.java:84) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (XContentTypeOptionsNoSniffFilter.java:22) (AbstractHttpFilter.java:31) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (HeaderSanitisingFilter.java:44) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (IteratingFilterChain.java:46) (DelegatingPluginFilter.java:66)
at com.atlassian.translations.inproduct.components.ServletFilter.doFilter(ServletFilter.java:31) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
at com.atlassian.labs.botkiller.BotKillerFilter.doFilter(BotKillerFilter.java:36) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
at com.atlassian.jira.tzdetect.IncludeResourcesFilter.doFilter(IncludeResourcesFilter.java:39) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
at com.atlassian.jira.baseurl.IncludeResourcesFilter.doFilter(IncludeResourcesFilter.java:38) <+8> (AbstractHttpFilter.java:31) (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) (ContextFilter.java:25) (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
at com.atlassian.mywork.client.filter.ServingRequestsFilter.doFilter(ServingRequestsFilter.java:37) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
at com.atlassian.prettyurls.filter.PrettyUrlsDispatcherFilter.doFilter(PrettyUrlsDispatcherFilter.java:60) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
at com.atlassian.prettyurls.filter.PrettyUrlsSiteMeshFilter.doFilter(PrettyUrlsSiteMeshFilter.java:92) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
at com.atlassian.prettyurls.filter.PrettyUrlsMatcherFilter.doFilter(PrettyUrlsMatcherFilter.java:56) <+20> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (ServletFilterModuleContainerFilter.java:77) (ServletFilterModuleContainerFilter.java:63) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (AccessLogFilter.java:103) (AccessLogFilter.java:87) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (XsrfTokenAdditionRequestFilter.java:54) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (SiteMeshFilter.java:129) (SiteMeshFilter.java:77) (SitemeshPageFilter.java:124) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (IteratingFilterChain.java:46) (DelegatingPluginFilter.java:66)
at com.atlassian.plugin.remotable.plugin.module.permission.ApiScopingFilter.doFilter(ApiScopingFilter.java:62) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
at com.atlassian.prettyurls.filter.PrettyUrlsCombinedMatchDispatcherFilter.doFilter(PrettyUrlsCombinedMatchDispatcherFilter.java:61) <+22> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (ServletFilterModuleContainerFilter.java:77) (ServletFilterModuleContainerFilter.java:63) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (SecurityFilter.java:234) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (TrustedApplicationsFilter.java:98) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (BaseLoginFilter.java:169) (JiraLoginFilter.java:70) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (IteratingFilterChain.java:46) (DelegatingPluginFilter.java:66) (OAuthFilter.java:55) (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
at com.atlassian.bonfire.web.filters.BonfireP3PFilter.doFilter(BonfireP3PFilter.java:57) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
at com.atlassian.prettyurls.filter.PrettyUrlsCombinedMatchDispatcherFilter.doFilter(PrettyUrlsCombinedMatchDispatcherFilter.java:61) <+13> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (ServletFilterModuleContainerFilter.java:77) (ServletFilterModuleContainerFilter.java:63) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (ProfilingFilter.java:99) (JIRAProfilingFilter.java:19) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (AbstractJohnsonFilter.java:71) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210)
at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) <+9> (UrlRewriteFilter.java:394) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (GzipFilter.java:80) (GzipFilter.java:51) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (IteratingFilterChain.java:46) (DelegatingPluginFilter.java:66)
at com.atlassian.plugin.remotable.plugin.module.oauth.OAuth2LOFilter.doFilter(OAuth2LOFilter.java:70) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
at com.atlassian.plugin.remotable.host.common.service.http.bigpipe.BigPipeRequestIdFilter.doFilter(BigPipeRequestIdFilter.java:33) <+3> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66)
at com.atlassian.prettyurls.filter.PrettyUrlsCombinedMatchDispatcherFilter.doFilter(PrettyUrlsCombinedMatchDispatcherFilter.java:61) <+41> (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (DelegatingPluginFilter.java:66) (JWDSendRedirectFilter.java:25) (DelegatingPluginFilter.java:74) (IteratingFilterChain.java:42) (ServletFilterModuleContainerFilter.java:77) (ServletFilterModuleContainerFilter.java:63) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (ChainedFilterStepRunner.java:84) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (AbstractCachingFilter.java:33) (AbstractHttpFilter.java:31) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (AbstractEncodingFilter.java:41) (AbstractHttpFilter.java:31) (PathMatchingEncodingFilter.java:49) (AbstractHttpFilter.java:31) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (JiraStartupChecklistFilter.java:74) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (ChainedFilterStepRunner.java:84) (JiraFirstFilter.java:57) (ApplicationFilterChain.java:243) (ApplicationFilterChain.java:210) (StandardWrapperValve.java:225) (StandardContextValve.java:123) (AuthenticatorBase.java:472) (StandardHostValve.java:168) (ErrorReportValve.java:98) (StandardEngineValve.java:118) (AccessLogValve.java:927) (CoyoteAdapter.java:407) (AbstractHttp11Processor.java:1001) (AbstractProtocol.java:585) (JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Diagnosis 1
The user can be successfully seen, edited or the user can log in successfully on other nodes in Jira DC or none of the nodes in some cases.
Below SQL does not return this user's name in the result set:
SELECT lower_user_name FROM cwd_user
WHERE lower_user_name NOT IN (SELECT lower_user_name FROM app_user);
If the above SQL returns the user's name in the result set please refer to this article Jira throws error user exists but has no unique key mapping on login
Diagnosis 2
Run the following query against the JIRA database to verify if this indeed happens due to a username containing a line break:
PostgreSQL:
SELECT * FROM cwd_user WHERE user_name LIKE '%
%';
SQL Server:
SELECT * FROM cwd_user WHERE user_name LIKE '%'+CHAR(10)+'%';
Cause 1
The user cache on the Jira node or nodes is not flushed successfully.
Cause 2
This happens because the user contains a line break in its username. The most likely reason for this to occur is importing a malformed CSV file which contains the line break in the user's name (JIM-1001). Jira not being able to handle this is being tracked on JRASERVER-33690.
Workaround 1
Refresh the User's Cache
Restarting Jira will clear the user's cache and recreate it once the application is started again.
If you have a Data Center installation, all nodes must be stopped at the same time leaving no running nodes and then started again one by one, otherwise the problematic cache can be replicated back to the restarted nodes.
Alternatively, we can use the following workaround to refresh the user cache without restarting:
- Create a brand new user directory - this directory does not necessarily actually have to work
- Delete the newly created directory. This will trigger the user and group caches to be invalidated.
- Synchronize any pre-existing external user directories.
Workaround 2
To avoid downtime to production servers, we highly recommended to verify this in a test or staging instance first.
- Generate an XML backup of your JIRA instance from Administration -> System > Backup System.
- Unzip/extract the backup ZIP file to get two XML files
activeobjects.xml
andentities.xml
. - Open the XML files in a text editor.
- Use the 'Find and Replace' feature of the text editor to replace e.g. 'Matheus
Fernandes' with 'matheusfernandes'; - Save the XML files.
- ZIP/compress the files together again.
- Re-import the modified backup ZIP file into JIRA from Administration -> System > Restore System.