Jira throws 'There are no issue type mappings for this scheme. This should never occur as the default entry should always exist!' message
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the server and data center platforms.
Problem
In the default Issue Type scheme, you will see the following error:
The following appears in the logs
/secure/admin/ConfigureIssueTypeScreenScheme.jspa [webwork.util.ValueStack] query="/issueTypeScreenSchemeEntities/empty" {[id="null" type="5" values=""]}
{[id="issueTypeScreenSchemeEntities" type="8" values=""]} {[id="empty" type="8" values=""]}
java.lang.reflect.InvocationTargetException
Caused by: java.lang.NullPointerException
at com.atlassian.jira.issue.comparator.IssueTypeKeyComparator.compare(IssueTypeKeyComparator.java:36)
at com.atlassian.jira.issue.fields.screen.issuetype.IssueTypeScreenSchemeEntityImpl.compareTo(IssueTypeScreenSchemeEntityImpl.java:156)
Diagnosis
Run the following SQL query to determine if you are affected by this issue:
select * from issuetypescreenschemeentity where issuetype not in (select id from issuetype);
If you are affected, this should return a results, else if there are no results from the above query, then you are not affected by this issue.
Cause
The issue occurs because there are issue types referenced in the issuetypescreenschemeentity table, however, they do not exist in the issuetype table.
Resolution
Shut down Jira
Run the following query to delete entries in the issuetypescreenschemeentity table that are invalid as they reference deleted/removed issue types.
delete from issuetypescreenschemeentity where issuetype not in (select id from issuetype);
Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
Start back Jira and verify if the issue persists