NullPointerException when Deleting a 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

Symptoms

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

(Auto-migrated image: description temporarily unavailable)

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

1 2 3 4 5 6 7 8 9 10 11 12 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 making any database modifications. 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

    1 2 3 4 5 6 7 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:

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

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.