Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
  • Community
  • Q&A
  • Jira
  • Questions
  • cannot update some custom field issue using jira rest api before refreshing manually the issue

cannot update some custom field issue using jira rest api before refreshing manually the issue

Salim
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 6, 2025

 

During a Jira migration to a new Jira Data Center instance where issue keys remain the same as in the previous instance”I am attempting to associate preconditions, test sets, and test plans to a test case using the  JIRA APIs, following the official documentation precisely. However, when I use, for example, PUT server/rest/api/2/issue/testkey to associate customfield_id  preconditions, test set, test plan and sending a correct json  I encounter a null pointer exception stating:  a cannot invoke java.lang.Integer.intValue because parameter 2 is null, and the API call returns a 400 error code along with the corresponding log trace.  java.lang.NullPointerException: Cannot invoke \"java.lang.Integer.intValue()\" because parameters 2 is null"],"errors":{}}

I have verified that all the custom fields are present on the screens, performed both background and full re-indexing, and even implemented retry mechanisms, but nothing has worked. Interestingly, when I manually open the ticket in the Jira browser and then rerun my script without modifying the code, the request succeeds for that ticket (returning a 204 no content status code). 

Since I have approximately 4600 test issues, manually opening each one is not possible

Could you please help identify the cause of this issue and suggest a possible resolution?

jira datacenter version : 09.12.14

Xray:  7.8.2-j9

 

1 answer

0 votes
Madhumitha N
Contributor
January 20, 2026

Hi @Salim ,

This issue is likely caused by missing or uninitialized field context or metadata for the migrated issues in the new Jira Data Center instance. When you manually open an issue in the browser, Jira loads and initializes all field contexts and caches for that issue, which is why subsequent API calls succeed. 

I'm not sure if this is correct or we have any other way, this is what I did in my prev migration.

Bulk Edit to Force Re-Save of Issues
Use Jira’s Bulk Change → Edit Issues feature to force Jira to re-save all affected issues, even without changing any values.

Steps:

  • Go to Issue Navigator
  • Search for all affected test issues (e.g., all Test issues migrated)
  • Select all issues
  • Choose Bulk Change → Edit Issues
  • Proceed without changing any field values (or change a harmless dummy field if Jira requires it)
  • Submit the bulk edit (NOTE: work items Updated date will update with this step)

This action:

Forces Jira to persist each issue again
Fully initializes all custom fields and their contexts
Makes the issues immediately usable by REST APIs

 

Suggest an answer

Log in or Sign up to answer