Cast error when trying to configure default value in 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 attempting to edit the default value or the options for a custom field, a System error screen will appear and a cast exception is thrown.

The following appears in the atlassian-jira.log:

1 2 3 4 5 6 7 8 9 10 java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long at com.atlassian.jira.issue.customfields.impl.SelectCFType.getDefaultValue(SelectCFType.java:243) at com.atlassian.jira.issue.customfields.impl.SelectCFType.getDefaultValue(SelectCFType.java:68) at com.atlassian.jira.issue.fields.CustomFieldImpl.populateDefaults(CustomFieldImpl.java:554) at com.atlassian.jira.issue.fields.screen.FieldScreenRenderLayoutItemImpl.populateDefaults(FieldScreenRenderLayoutItemImpl.java:92) at com.atlassian.jira.issue.fields.rest.FieldHtmlFactoryImpl.getCreateFields(FieldHtmlFactoryImpl.java:86) 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)

Environment

Jira Data Center on any version

Diagnosis

The default value for the affected custom field is stored under the genericconfiguration table. To discover which entry is related with the problematic custom field, we will need to first discover the field configuration id for this custom field. Therefore, please run the query below, replacing 'XXXXX' with the ID of the custom field.

1 SELECT * FROM fieldconfiguration WHERE fieldid = 'customfield_XXXXX';

If you are not sure about the custom field id that you need to look for on the query above, you might discover it upon running the query below. Please replace the query below with the custom field name and run it.

1 SELECT * FROM customfield WHERE cfname = 'AFFECTED CUSTOM FIELD NAME';

Cause

Seems that the default value for the affected custom field has an invalid value on the genericconfigurationtable.

Solution

Resolution

Perform a database backup, so this way you can prevent any data loss caused by a wrong manipulation on JIRA data.

  1. Shutdown JIRA.

  2. Get the rows from genericconfiguration table which needs to be deleted. You can discover which entries must be deleted by running the following query:

    1 SELECT * FROM genericconfiguration WHERE datakey = 'ID OF FIELDCONFIGURATION ENTRY'

    ℹ️ The field configuration id is the one get from the query mentioned on "Diagnosis" section on this article.

  3. Delete the returned results from query above.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.