NullPointerException when Deleting a Custom Field

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

When creating or updating an issue, the following error is thrown in JIRA:


When trying to delete a custom field, the custom field cannot be removed. The stacktrace will appear as following in the JIRA log files:

java.lang.NullPointerException

at com.atlassian.jira.issue.customfields.persistence.OfBizCustomFieldValuePersister.removeAllValues(OfBizCustomFieldValuePersister.java:180)
at com.atlassian.jira.issue.customfields.persistence.EagerLoadingOfBizCustomFieldPersister.removeAllValues(EagerLoadingOfBizCustomFieldPersister.java:62)
at com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType.remove(AbstractSingleFieldType.java:106)
at com.atlassian.jira.issue.fields.CustomFieldImpl.remove(CustomFieldImpl.java:649)
at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.removeCustomField(DefaultCustomFieldManager.java:374)
at com.atlassian.jira.web.action.admin.customfields.DeleteCustomField.doExecute(DeleteCustomField.java:34)
at webwork.action.ActionSupport.execute(ActionSupport.java:153)
...

(more)

Cause

The database is corrupted. There is a custom field value associated to a 'NULL' issue.

Resolution

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.

  1. Stop JIRA
  2. Perform the following SQL query to check whether there are any custom fields assigned to 'NULL' issue. You should get

    select * from customfieldvalue where ISSUE is null; 
    +-------+-------+-------------+-----------+------------------+-------------+-----------+-----------+-----------+
    | ID    | ISSUE | CUSTOMFIELD | PARENTKEY | STRINGVALUE      | NUMBERVALUE | TEXTVALUE | DATEVALUE | VALUETYPE |
    +-------+-------+-------------+-----------+------------------+-------------+-----------+-----------+-----------+
    | 36625 |  NULL |       10000 | NULL      | Field value      |        NULL | NULL      | NULL      | NULL      | 
    +-------+-------+-------------+-----------+------------------+-------------+-----------+-----------+-----------+
    1 row in set (0.00 sec)
    
  3. Remove the custom field value:

    delete from customfieldvalue where issue is null;
    
  4. Restart JIRA

Last modified on Mar 21, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.