Troubleshooting 'Option id null is not valid' with Java Jira API Custom Fields

Using Java Jira API, I get ‘Option id null is not valid’ while updating a custom field called ‘DetectedByTest’. Tried several methods, yet the error persists. Example:

Map<String, Object> fieldOptions = new HashMap<>();
fieldOptions.put("optionValue", "Functional Testing");
fieldOptions.put("optionId", "67890");
fieldOptions.put("optionActive", true);
fieldOptions.put("ref", "/rest/api/2/customFieldOption/67890");

issueAdapter.setCustomField("customfield_15870", new CustomFieldInputValue(fieldOptions));

The issue seems to be related to how the custom field is processing the input values. In my experience, it helped to ensure that the option value and ID match exactly as expected by the Jira API. Sometimes, discrepancies in field configuration lead to errors like this. I had to verify that the provided IDs were correctly set up in the custom field’s schema and that the API referenced the exact custom field option. I found adding additional logging around the update call also revealed subtle mismatches.