Error when removing an option from a select list custom field
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
Symptoms
When trying to remove an option from a select list custom field, an error screen is displayed by JIRA.
The following appears in the Technical Details of that error, and also in atlassian-jira.log
:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2014-01-31 16:56:30,583 http-bio-10617-exec-19 ERROR admin 1016x557x1 187l96b 0:0:0:0:0:0:0:1%0 /secure/admin/EditCustomFieldOptions!remove.jspa [webwork.util.ValueStack] query="affectedIssues/size" {[id="affectedIssues" type="8" values=""]} {[id="size" type="8" values=""]}
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
...lots of lines...
Caused by: java.lang.NullPointerException
at com.atlassian.jira.issue.context.ProjectContext.<init>(ProjectContext.java:49)
at com.atlassian.jira.issue.fields.config.manager.FieldConfigSchemeManagerImpl.getRelevantConfigScheme(FieldConfigSchemeManagerImpl.java:321)
at com.atlassian.jira.issue.fields.config.manager.FieldConfigSchemeManagerImpl.getRelevantConfig(FieldConfigSchemeManagerImpl.java:292)
at com.atlassian.jira.issue.fields.CustomFieldImpl.getRelevantConfig(CustomFieldImpl.java:637)
at com.atlassian.jira.issue.fields.CustomFieldImpl.getRelevantConfig(CustomFieldImpl.java:644)
... 274 more
Diagnosis
Run the below SQL to detect corrupt entries in the datbase:
1
2
3
select cfv.* from customfieldvalue cfv
left join jiraissue ji on (cfv.issue = ji.id)
where ji.id is null;
If any rows are returned, you are affected by this issue.
Cause
There are some assignments of the custom field value to issues which no longer exist. When JIRA tries to delete the custom field value, it fails when looking for the missing issue which the custom field is assigned to. We're not sure how to reproduce this with the JIRA UI, however this could occur due to issues being removed via SQL.
Solution
Resolution
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.
Stop JIRA
Run the below sql to remove all the affected issues
1 2 3 4 5 6
delete from customfieldvalue where id in ( select cfv.id from customfieldvalue cfv left join jiraissue ji on (cfv.issue = ji.id) where ji.id is null);
Start JIRA
Was this helpful?