Sorting search results using multi user picker custom field returns error
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
Problem
When sorting search results in Issue Navigator using a user picker (multiple users) custom field, the following error appears in the UI.

The following appears in the atlassian-jira.log
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2019-09-02 14:07:28,467 http-nio-8810-exec-25 ERROR admin 847x9033x2 4qwqde 10.60.2.3 /rest/issueNav/1/issueTable [c.a.p.r.c.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: java.util.ArrayList cannot be cast to java.lang.String
java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.String
at com.atlassian.jira.issue.customfields.impl.MultiUserCFType.compare(MultiUserCFType.java:85)
at com.atlassian.jira.issue.fields.ImmutableCustomField.compare(ImmutableCustomField.java:1639)
at com.atlassian.jira.issue.fields.ImmutableCustomField$CustomFieldIssueSortComparator.compare(ImmutableCustomField.java:1729)
at com.atlassian.jira.issue.fields.ImmutableCustomField$CustomFieldIssueSortComparator.compare(ImmutableCustomField.java:1716)
at com.atlassian.jira.issue.search.parameters.lucene.sort.DefaultIssueSortComparator.compare(DefaultIssueSortComparator.java:31)
at com.atlassian.jira.issue.search.parameters.lucene.sort.DocumentSortComparatorSource$InternalFieldComparator.compare(DocumentSortComparatorSource.java:63)
at org.apache.lucene.search.FieldValueHitQueue$OneComparatorFieldValueHitQueue.lessThan(FieldValueHitQueue.java:81)
at org.apache.lucene.search.FieldValueHitQueue$OneComparatorFieldValueHitQueue.lessThan(FieldValueHitQueue.java:56)
at org.apache.lucene.util.PriorityQueue.upHeap(PriorityQueue.java:263)
at org.apache.lucene.util.PriorityQueue.add(PriorityQueue.java:140)
at org.apache.lucene.search.TopFieldCollector.add(TopFieldCollector.java:539)
at org.apache.lucene.search.TopFieldCollector$SimpleFieldCollector$1.collect(TopFieldCollector.java:179)
at org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:233)
at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:184)
at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:660)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:462)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:583)
at org.apache.lucene.search.IndexSearcher.searchAfter(IndexSearcher.java:568)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:493)
Cause
The custom field has no Search Template configured.
⚠️ It only affects User Picker (multiple users)
Resolution
Configure a Search Template for the affected custom field(s).
Navigate to the Custom Fields page (Cog Icon > Issues > Custom Fields)
Locate the affected multi user custom field, click on the cog icon next to it and select "Edit"
In the Search Template dropdown menu, select the only value available and click on "Update"
Verify if the sort works now
ℹ️ Suggestion request to improve the error message - JRASERVER-69922 - Improve error message on invalid search template
Was this helpful?