Error "Issue Type for issue with id '...' is null" when searching issues in Jira
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs 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
Problem
When searching for issues in Jira, a big block of errors might be shown on the screen, starting with:
1
The message is "An error occurred whilst rendering this message. Please contact the administrators, and inform them of this bug. Details: ------- org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getHtml' in class com.atlassian.jira.issue.fields.layout.column.ColumnLayoutItemImpl threw exception java.lang.IllegalArgumentException: Issue Type for issue with id '...' is null."
Environment
Confirmed in Jira 8.5 and Jira Service Management 4.5.
Likely to happen on several Jira 7 and 8 versions as well.
Diagnosis
The error on the screen will start with:
1
An error occurred whilst rendering this message. Please contact the administrators, and inform them of this bug. Details: ------- org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getHtml' in class com.atlassian.jira.issue.fields.layout.column.ColumnLayoutItemImpl threw exception java.lang.IllegalArgumentException: Issue Type for issue with id '...' is null.
And in the atlassian-jira.log we should see:
1
2020-05-07 07:54:00,037 http-nio-127.0.0.1-8080-exec-61 ERROR <username> 473x2230574x1 e0lj6e <ip addresses>,127.0.0.1 /issues/ [c.atlassian.velocity.DefaultVelocityManager] MethodInvocationException occurred getting message body from Velocity: java.lang.IllegalArgumentException: Issue Type for issue with id '...' is null.
Which '...' can be any number that represents an issue's internal id on the jiraissue
database table.
Cause
This error is caused due to issues not having an associated issue type, just like the error messages suggest.
This is an exception to Jira's behavior and might have happened during interrupted operations like moving issues, bulk editions, data import or direct interference on the database.
Solution
The solution is to identify the corrupted issues, fix them on the database and further delete them if needed.
ℹ️ The queries below are for the PostgreSQL database. You may need to alter them for your own database type.
Always back up your data before making any database modifications. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
The number of affected issues might be higher than what was triggered by the issue search, so we perform a broader search on the database:
1 2 3 4
select i.id, p.pkey, i.issuenum, i.issuetype from jiraissue i join project p on p.id = i.project where i.issuetype is null or i.issuetype in ('', ' ');
For each different project key (pkey) that was returned above, select an issue type id available from the output of the query below:
1 2 3 4 5 6 7
select p.pkey, it.id, it.pname from project p join configurationcontext cc on p.id = cc.project join fieldconfigschemeissuetype fci on fci.fieldconfigscheme = cc.fieldconfigscheme join optionconfiguration oc on oc.fieldconfig = fci.fieldconfiguration join issuetype it on it.id = oc.optionid where p.pkey = 'PROJECT-KEY'; -- <<< Replace PROJECT-KEY
Update the issues with the desired issue type id:
To update issues separately
1
update jiraissue set summary = 'abcdefghijk', issuetype = <issue-type-id> where id in (<list of issue ids separated by comma>);
To update all corrupted issues
1
update jiraissue set summary = 'abcdefghijk', issuetype = <issue-type-id> where issuetype is null or i.issuetype in ('', ' ');
Restart Jira
After Jira's back online, we may search for those corrected issues and bulk edit them as we want — even bulk delete them if that's the intention.
JQL to search for the issues
1
summary ~ 'abcdefghijk'
Was this helpful?