question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Regular expression is invalid: \ in cases search

See original GitHub issue

A current bug in prod. Apparently #3356 didn’t fix all these cases?

Traceback (most recent call last):
  File "/venv/lib/python3.8/site-packages/flask/app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
  File "/venv/lib/python3.8/site-packages/flask/app.py", line 1525, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/venv/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/venv/lib/python3.8/site-packages/flask/app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "/venv/lib/python3.8/site-packages/flask/app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/worker/app/scout/server/utils.py", line 85, in decorated_function
    context = func(*args, **kwargs)
  File "/home/worker/app/scout/server/blueprints/institutes/views.py", line 59, in cases
    return controllers.cases(store, request, institute_id)
  File "/home/worker/app/scout/server/blueprints/institutes/controllers.py", line 328, in cases
    all_cases = store.cases(
  File "/home/worker/app/scout/adapter/mongo/case.py", line 352, in cases
    order = self._populate_name_query(query, name_query, owner, collaborator)
  File "/home/worker/app/scout/adapter/mongo/case.py", line 239, in _populate_name_query
    query["assignees"] = {"$in": [user["email"] for user in users]}
  File "/home/worker/app/scout/adapter/mongo/case.py", line 239, in <listcomp>
    query["assignees"] = {"$in": [user["email"] for user in users]}
  File "/venv/lib/python3.8/site-packages/pymongo/cursor.py", line 1238, in next
    if len(self.__data) or self._refresh():
  File "/venv/lib/python3.8/site-packages/pymongo/cursor.py", line 1155, in _refresh
    self.__send_message(q)
  File "/venv/lib/python3.8/site-packages/pymongo/cursor.py", line 1044, in __send_message
    response = client._run_operation(
  File "/venv/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1424, in _run_operation
    return self._retryable_read(
  File "/venv/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1525, in _retryable_read
    return func(session, server, sock_info, secondary_ok)
  File "/venv/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1420, in _cmd
    return server.run_operation(
  File "/venv/lib/python3.8/site-packages/pymongo/server.py", line 130, in run_operation
    _check_command_response(first, sock_info.max_wire_version)
  File "/venv/lib/python3.8/site-packages/pymongo/helpers.py", line 167, in _check_command_response
    raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: Regular expression is invalid: \ at end of pattern, full error: {'operationTime': Timestamp(1655129981, 3), 'ok': 0.0, 'errmsg': 'Regular expression is invalid: \\ at end of pattern', 'code': 51091, 'codeName': 'Location51091', '$clusterTime': {'clusterTime': Timestamp(1655129981, 3), 'signature': {'hash': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'keyId': 0}}}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
northwestwitchcommented, Jun 14, 2022

Or perhaps this one appeared fresh with it? That seems like a common escape character.

Possibly. Tried to trigger the same problem locally or on stage but couldn’t. Who knows what they were typing!

0reactions
dnilcommented, Jun 16, 2022

I wonder who and why, but yes, good!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Case insensitive - "SyntaxError: Invalid regular expression"
In mongodb the $regex query operator allows options. With RESTHeart the query filter should be as follows for case insensitive regex query.
Read more >
SyntaxError: invalid regular expression flag "x" - MDN Web Docs
The JavaScript exception "invalid regular expression flag" occurs when the flags in a regular expression ... i, Case-insensitive search.
Read more >
Invalid regular expression in search field cause procedure to fail
Press Ctrl+F in Visual Studio Code · Enter an invalid regular expression · Select Use regular expression · Click outside the Search window ......
Read more >
How to react to invalid search regex? — DataTables forums
I use RegEx search in my table and I noticed that searching for an invalid RegEx, e.g. ( will throw errors in the...
Read more >
Regular expression syntax reference | IntelliJ IDEA ... - JetBrains
This section is a brief summary of regexp syntax that can be used for creating search and replace as well as issue navigation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found