Email this issue error - Failed to switch user perform-as-user!

Kamil Beer December 5, 2019

Hi,

I am trying to fix an instance that gets issues from e-mail through e-mail this issue. A field "sender" is populated with the sender's email. This field draws various other fields from an external database through nFeed (based on the "Sender" field). Whenever this happens, the issue cannot move through a workflow and an error "Unable to create an issue because of this error: Failed to switch user perform-as-user!." is logged.

Also, Integrity Checker tells me that " The workflow entry with id 158427 has an incorrect state. ". When i Fix the issue, I can move the issue through the workflow.


Any ideas as to what's up? Have you seen a similar log message?

Full log below.

 

2019-12-06 00:35:03,546 Caesium-1-1 ERROR kamil.beer EMAIL HANDLER [c.m.j.p.emailissue.handler.EmailThisIssueMailHandler] com.atlassian.jira.workflow.WorkflowException: Failed to switch user perform-as-user!
javax.mail.MessagingException: com.atlassian.jira.workflow.WorkflowException: Failed to switch user perform-as-user!;
nested exception is:
javax.mail.MessagingException: com.atlassian.jira.workflow.WorkflowException: Failed to switch user perform-as-user!;
nested exception is:
com.atlassian.jira.exception.CreateException: com.atlassian.jira.workflow.WorkflowException: Failed to switch user perform-as-user!
at com.metainf.jira.plugin.emailissue.handler.AbstractMailHandler.handleMessage(AbstractMailHandler.java:141)
at com.metainf.jira.plugin.emailissue.handler.EmailThisIssueMailHandler.handleMessage(EmailThisIssueMailHandler.java:720)
at com.atlassian.jira.service.services.mail.MailFetcherService.processMessage(MailFetcherService.java:415)
at com.atlassian.jira.service.services.mail.MailFetcherService$MessageProviderImpl.getAndProcessMail(MailFetcherService.java:272)
at com.atlassian.jira.service.services.mail.MailFetcherService.processMessages(MailFetcherService.java:404)
at com.atlassian.jira.service.services.mail.MailFetcherService.runImpl(MailFetcherService.java:396)
at com.atlassian.jira.service.services.file.AbstractMessageHandlingService.run(AbstractMessageHandlingService.java:229)
at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:68)
at com.atlassian.jira.service.ServiceRunner.runService(ServiceRunner.java:62)
at com.atlassian.jira.service.ServiceRunner.runServiceId(ServiceRunner.java:44)
at com.atlassian.jira.service.ServiceRunner.runJob(ServiceRunner.java:32)
at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:153)
at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:118)
at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:97)
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:443)
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJob(CaesiumSchedulerService.java:438)
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJobWithRecoveryGuard(CaesiumSchedulerService.java:462)
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:390)
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:285)
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:282)
at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:65)
at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:59)
at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:34)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.mail.MessagingException: com.atlassian.jira.workflow.WorkflowException: Failed to switch user perform-as-user!;
nested exception is:
com.atlassian.jira.exception.CreateException: com.atlassian.jira.workflow.WorkflowException: Failed to switch user perform-as-user!
at com.metainf.jira.plugin.emailissue.handler.CreateIssueHandler.handleMessage(CreateIssueHandler.java:230)
at com.metainf.jira.plugin.emailissue.handler.ReporterResolvingCreateOrCommentHandler.handleMessage(ReporterResolvingCreateOrCommentHandler.java:139)
at com.metainf.jira.plugin.emailissue.handler.CreateOrCommentWithRegexpHandler.handleMessage(CreateOrCommentWithRegexpHandler.java:49)
... 23 more
Caused by: com.atlassian.jira.exception.CreateException: com.atlassian.jira.workflow.WorkflowException: Failed to switch user perform-as-user!
at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:519)
at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssueObject(DefaultIssueManager.java:608)
at com.atlassian.jira.issue.managers.RequestCachingIssueManager.createIssueObject(RequestCachingIssueManager.java:209)
at com.atlassian.jira.service.util.handler.DefaultMessageHandlerContext.createIssueWithIssueManager(DefaultMessageHandlerContext.java:248)
at com.atlassian.jira.service.util.handler.DefaultMessageHandlerContext.createIssue(DefaultMessageHandlerContext.java:166)
at com.metainf.jira.plugin.emailissue.handler.EmailThisIssueMailHandler$1.createIssue(EmailThisIssueMailHandler.java:450)
at com.metainf.jira.plugin.emailissue.handler.IssueSupportingMessageHandlerContext.createIssue(IssueSupportingMessageHandlerContext.java:78)
at com.metainf.jira.plugin.emailissue.handler.CreateIssueHandler.createIssueInContext(CreateIssueHandler.java:244)
at com.metainf.jira.plugin.emailissue.handler.CreateIssueHandler.handleMessage(CreateIssueHandler.java:223)
... 26 more
Caused by: com.atlassian.jira.workflow.WorkflowException: Failed to switch user perform-as-user!
at com.atlassian.jira.workflow.OSWorkflowManager.createIssue(OSWorkflowManager.java:761)
at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:510)
... 35 more
Caused by: com.opensymphony.workflow.WorkflowException: Failed to switch user perform-as-user!
at ch.beecom.jira.jsu.workflow.function.copyvaluefromotherfield.CopyValueFromOtherFieldPostFunction.executeFunction(CopyValueFromOtherFieldPostFunction.java:127)
at ch.beecom.jira.jsu.workflow.precondition.AbstractPreconditionAwareFunction.execute(AbstractPreconditionAwareFunction.java:51)
at com.opensymphony.workflow.AbstractWorkflow.executeFunction(AbstractWorkflow.java:1014)
at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java:1407)
at com.opensymphony.workflow.AbstractWorkflow.initialize(AbstractWorkflow.java:606)
at com.atlassian.jira.workflow.OSWorkflowManager.createIssue(OSWorkflowManager.java:742)
... 36 more

1 answer

1 accepted

0 votes
Answer accepted
Cyndy Bunte December 9, 2019

Hi Kamil - I had this error occur today and found that it was caused by a post-function in my workflow.  The post-function was attempting to fill a field that was not on my issue type (Epic Status). To resolve the issue I copied the existing workflow, removed the post-function, mapped my 'Incident' issue types to the new workflow and 'voila' no more error. Hope this helps!

Kamil Beer December 10, 2019

Hi Cyndy, strange thing was that even when I deleted all the transitions and made new ones, the error still occured! It must have been somehow hardwired into the workflow.

Suggest an answer

Log in or Sign up to answer