NullPointerException while editing the name of a transition
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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
While editing the name of a transition, the error "common.forms.ajax.servererror" is thrown by the Jira UI:
Environment
All versions
Diagnosis
Following exception is found in the atlassian-jira.log:
Uncaught exception thrown by REST service: null
java.lang.NullPointerException
at com.atlassian.jira.workflow.edit.Workflow.isDuplicateStepTransitionName(Workflow.java:793)
at com.atlassian.jira.workflow.edit.Workflow.isDuplicateTransitionName(Workflow.java:743)
at com.atlassian.jira.workflow.edit.Workflow.isDuplicateTransitionName(Workflow.java:506)
at com.atlassian.jira.workflow.edit.WorkflowTransitionsImpl.verifyTransitionCanBeUpdated(WorkflowTransitionsImpl.java:325)
at com.atlassian.jira.workflow.edit.WorkflowTransitionsImpl.updateTransition(WorkflowTransitionsImpl.java:95)
... 3 filtered
Or in alternative:
1999-00-00 00:00:00,000+0000 http-nio-0080-exec-0 url: /jira/rest/workflowDesigner/latest/workflows/transitions; user: USER ERROR USER SESSIONID IP /rest/workflowDesigner/latest/workflows/transitions [c.a.p.r.c.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: Cannot invoke "com.opensymphony.workflow.loader.StepDescriptor.getActions()" because "sourceStep" is null
java.lang.NullPointerException: Cannot invoke "com.opensymphony.workflow.loader.StepDescriptor.getActions()" because "sourceStep" is null
at com.atlassian.jira.workflow.edit.Workflow.isDuplicateStepTransitionName(Workflow.java:794)
at com.atlassian.jira.workflow.edit.Workflow.isDuplicateTransitionName(Workflow.java:744)
at com.atlassian.jira.workflow.edit.Workflow.isDuplicateTransitionName(Workflow.java:507)
Cause
A transition step is not found in the Workflow and fails with NullPointerException.
Solution
Please Note
We strongly recommend testing the solution in a Staging environment and taking a backup of your database before updating the DB data.
For Production schedule a maintenance window to proceed
Solution 1
- Export the workflow as xml.
- Open it up in a text editor.
Check for tag <initial-actions> in the XML.
Notice what step ID is mentioned in the tag unconditional-result, it should be different than 1 :
<unconditional-result old-status="null" status="open" step="10">
- When status is open(which is the Create issue step), API checks for step ID 1 as next step.
- Take the back up of XML. Modify this step ID to 1 and also track corresponding <step> tag to modify its ID as well to step id="1".
- Take a backup of the existing workflow and replace it with the modified one.
Example: How to locate it in workflow:
Solution 2
Alternatively, and in case the workflow cannot be deleted from the UI, you can follow these steps:
- Follow steps 1 to 6 in Solution 1
- Stop Jira
- Update the XML entity in the DB as follows:
UPDATE jiraworkflows SET descriptor = '<paste here the full edited XML>' where id = '<database workflow id>';
- Start Jira