# Bug OP-20804 - RegexpError in GET::API::V3::WorkPackages::WorkPackagesAPI#/:version/work_packages

Project: OpenProject
Status: merged
URL: https://community.openproject.org/work_packages/OP-20804

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module | Modules and project features / Search |
| Target versions | 18.0.1 |
| Observed in versions | 18.0.0 |
| Sprint |  |
| Backlog bucket |  |
| Bug found in version (deprecated) |  |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable | Pavel Balashou |
| Product manager |  |
| Developers | Jens Ulferts |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### Steps to reproduce

1.  Open the top bar search and type anything starting with a parenthesis: `(unable`

### What is the buggy behavior?

  - No results are returned.

  - An error is raised, see below in the logs.

  - `RegexpError (end pattern with unmatched parenthesis: /(unable/):`

### What is the expected behavior?

  - Search results should work.

  - No error should be raised.

### **Logs**

**Appsignal:**

  - <https://appsignal.com/openproject-gmbh/sites/673c529383eb67b55471dda2/exceptions/incidents/2293>

  - <https://appsignal.com/openproject-gmbh/sites/673c529383eb67b55471dda2/exceptions/incidents/2292/traces/last>

  - <https://appsignal.com/openproject-gmbh/sites/673c529383eb67b55471dda2/exceptions/incidents/2326>

  - <https://appsignal.com/openproject-gmbh/sites/678fa146338a5d816f8d696c/exceptions/incidents/2255/traces/18bc8bd6d9a7ae34f3f77b5b8f94d978>

  - <https://appsignal.com/openproject-gmbh/sites/673c529383eb67b55471dda2/exceptions/incidents/2410>

<!-- end list -->

``` bash
end pattern with unmatched parenthesis: /(ssl_connect/
BACKTRACE

Application backtrace

Full backtrace
app/models/queries/work_packages/filter/typeahead_filter.rb:80 String#match
app/models/queries/work_packages/filter/typeahead_filter.rb:80 Queries::WorkPackages::Filter::TypeaheadFilter#status_condition
app/models/queries/work_packages/filter/typeahead_filter.rb:50 Queries::WorkPackages::Filter::TypeaheadFilter#conditions_for
app/models/queries/work_packages/filter/typeahead_filter.rb:43 block in Queries::WorkPackages::Filter::TypeaheadFilter#where
app/models/queries/work_packages/filter/typeahead_filter.rb:43 Array#map
app/models/queries/work_packages/filter/typeahead_filter.rb:43 Queries::WorkPackages::Filter::TypeaheadFilter#where
app/models/query.rb:421 block in Query#statement
app/models/query.rb:421 Array#map
app/models/query.rb:421 Query#statement
app/models/query/results.rb:87 Query::Results#filtered_work_packages
app/models/query/results.rb:61 Query::Results#sorted_work_packages_matching_the_filters_today
app/models/query/results.rb:53 Query::Results#work_packages
app/services/api/v3/work_package_collection_from_query_service.rb:59 API::V3::WorkPackageCollectionFromQueryService#results_to_representer
app/services/api/v3/work_package_collection_from_query_service.rb:48 API::V3::WorkPackageCollectionFromQueryService#call
app/services/api/v3/work_package_collection_from_query_params_service.rb:43 API::V3::WorkPackageCollectionFromQueryParamsService#call
lib/api/v3/work_packages/work_packages_api.rb:51 block (3 levels) in <class:WorkPackagesAPI>
lib/api/root_api.rb:261 API::RootAPI::Helpers#raise_invalid_query_on_service_failure
lib/api/v3/work_packages/work_packages_api.rb:48 block (2 levels) in <class:WorkPackagesAPI>
```

From: <https://appsignal.com/openproject-gmbh/sites/673c529383eb67b55471dda2/exceptions/incidents/2293>

``` ruby
{
  "filters": "[{\"typeahead\":{\"operator\":\"**\",\"values\":[\"Ett fel uppstod när E-post skulle skickas (SSL_connect returned=1 errno=0 peeraddr=111.111.111.111:25 state=error: certificate verify failed (unable to get local issuer certificate))\"]}}]",
  "offset": "1",
  "pageSize": "20",
  "sortBy": "[[\"exactMatch\",\"desc\"],[\"updatedAt\",\"desc\"]]"
}
```

### 

From: <https://appsignal.com/openproject-gmbh/sites/673c529383eb67b55471dda2/exceptions/incidents/2292/traces/last>

``` text
{
  "action": "index",
  "controller": "work_packages/auto_completes",
  "format": "json",
  "q": "HenrietteApproach)",
  "scope": "all"
}
```
