Errors when trying to display or edit filters with broken JQL
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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
Due to invalid JQL stored in a Jira filter's or board quick filter's content, loading pages containing that filter fail with an error 500. Often, NoViableAltException
is shown.
Environment
Jira Server or Jira Data Center
Diagnosis
Any attempt to load or edit filters will fail with 500 errors, internal server configuration errors, or uncaught exceptions.
For example, viewing the Manage Filters page will not work, and an error like the following will be displayed:
com.atlassian.cache.CacheException: com.atlassian.jira.exception.DataAccessException: com.atlassian.jira.jql.parser.JqlParseException: com.atlassian.jira.jql.parser.antlr.RuntimeRecognitionException: NoViableAltException(59@[])
Cause
The JQL in one or more filters' database entry has an invalid syntax. This will cause most screens that use filters, even unrelated filters, to fail to load. Editing or even removing the broken filters via the REST API may also fail.
Because it is not possible to save a filter with invalid JQL through the Jira interface, the underlying cause of this problem in the database is unknown in these situations.
Solution
Note that manual manipulation of the database can be dangerous. Please make sure you have a backup of your database before you attempt these changes.
If possible, the filter should be edited (or deleted) with the REST API as described in the REST API Filter documentation. Direct database edits should be used as a last resort.
The following statements are written for postgres and may need to be modified to work in other database systems.
- Identify the filter with the invalid JQL by checking the filter and quick filter tables:
SELECT id, filtername, reqcontent FROM searchrequest; SELECT id, "LONG_QUERY" FROM "AO_60DB71_QUICKFILTER";
- find the filter with the invalid JQL statement in the reqcontent and/or LONG_QUERY columns
- if the error message contains a filter id, you may wish to look it up directly like so:
SELECT id, filtername, reqcontent FROM searchrequest WHERE id = <filter_id_here>; id | filtername | reqcontent -------+--------------+----------------------------- 10100 | brokenfilter | invalid jql "@" /$ \ ? here
SELECT * FROM searchrequest; id | filtername | authorname | description | username | groupname | projectid | reqcontent | fav_count | filtername_lower -------+-----------------------+---------------+-------------+---------------+-----------+-----------+----------------------------------+-----------+----------------------- 10000 | Filter for DEVL board | JIRAUSER10000 | | JIRAUSER10000 | | | project = DEVL ORDER BY Rank ASC | 9001 | filter for devl board 10100 | brokenfilter | JIRAUSER10000 | | JIRAUSER10000 | | | invalid jql "@" /$ \ ? here | 1 | brokenfilter
- Edit the database record in question to set the filter content to a valid JQL
For a filter:
UPDATE searchrequest SET reqcontent = 'project = PROJKEY' WHERE id = <filter_id_here>;
For a board Quick Filter:
UPDATE "AO_60DB71_QUICKFILTER" SET LONG_QUERY = 'project = PROJKEY' WHERE id = <quick_filter_id_here>;
- Confirm that the previously problematic page works as expected