Internal Server Error on Activity tab

Hi, I only recently got to use the software for about 3-4 days and after some use today, I got “Internal Server Error” on the Activity tab n it doesn’t load the data, importing buckets works fine if u exclude the internal server error on activity tab.On Timeline n stopwatch tabs, the records were kept. After trying to following the steps of a past thread ({"message": "Internal Server Error"} when I try import buckets)

Shut down all watchers (to make sure they are not re-created right after)
Delete all buckets in the web-ui
Try to import again

After failing a few times to follow the steps, I got it right n as mentioned before the situation didn’t change.

So I went to aw-server logs as mentioned only to find a 186,871KB log, that may have been because I failed the steps n did not disable the watchers multiple times.

The latest log writes the following:

2021-04-03 12:26:14 [INFO ]: Using storage method: peewee  (aw_server.main:26)
2021-04-03 12:26:14 [INFO ]: Starting up...  (aw_server.main:31)
2021-04-03 12:26:14 [INFO ]: Using database file: C:\Users\Alex\AppData\Local\activitywatch\activitywatch\aw-server\peewee-sqlite.v2.db  (aw_datastore.storages.peewee:116)
2021-04-03 12:26:14 [INFO ]:  * Running on http://localhost:5600/ (Press CTRL+C to quit)  (werkzeug:122)
2021-04-03 12:26:15 [INFO ]: 404 (127.0.0.1): POST /api/0/buckets/aw-watcher-web-firefox/heartbeat?pulsetime=80 HTTP/1.1  (flask:25)
2021-04-03 12:26:15 [INFO ]: 404 (127.0.0.1): POST /api/0/buckets/aw-watcher-web-firefox/heartbeat?pulsetime=80 HTTP/1.1  (flask:25)
2021-04-03 12:26:15 [INFO ]: 404 (127.0.0.1): POST /api/0/buckets/aw-watcher-web-firefox/heartbeat?pulsetime=80 HTTP/1.1  (flask:25)
2021-04-03 12:26:15 [INFO ]: 404 (127.0.0.1): POST /api/0/buckets/aw-watcher-web-firefox/heartbeat?pulsetime=80 HTTP/1.1  (flask:25)
2021-04-03 12:26:16 [INFO ]: 404 (127.0.0.1): POST /api/0/buckets/aw-watcher-web-firefox/heartbeat?pulsetime=80 HTTP/1.1  (flask:25)
2021-04-03 12:26:18 [INFO ]: Deleting bucket 'aw-watcher-afk_DESKTOP-JQDUG43'  (aw_datastore.datastore.Datastore:59)
2021-04-03 12:26:18 [INFO ]: 404 (127.0.0.1): POST /api/0/buckets/aw-watcher-web-firefox/heartbeat?pulsetime=80 HTTP/1.1  (flask:25)
2021-04-03 12:26:19 [INFO ]: 404 (127.0.0.1): POST /api/0/buckets/aw-watcher-web-firefox/heartbeat?pulsetime=80 HTTP/1.1  (flask:25)
2021-04-03 12:26:19 [INFO ]: 404 (127.0.0.1): POST /api/0/buckets/aw-watcher-web-firefox/heartbeat?pulsetime=80 HTTP/1.1  (flask:25)
2021-04-03 12:26:20 [INFO ]: Deleting bucket 'aw-watcher-window_DESKTOP-JQDUG43'  (aw_datastore.datastore.Datastore:59)
2021-04-03 12:26:22 [INFO ]: 404 (127.0.0.1): POST /api/0/buckets/aw-watcher-web-firefox/heartbeat?pulsetime=80 HTTP/1.1  (flask:25)
2021-04-03 12:26:26 [INFO ]: Importing bucket aw-watcher-window_DESKTOP-JQDUG43  (aw_server.api:102)
2021-04-03 12:26:26 [INFO ]: Creating bucket 'aw-watcher-window_DESKTOP-JQDUG43'  (aw_datastore.datastore.Datastore:52)
2021-04-03 12:26:27 [INFO ]: Importing bucket aw-watcher-afk_DESKTOP-JQDUG43  (aw_server.api:102)
2021-04-03 12:26:27 [INFO ]: Creating bucket 'aw-watcher-afk_DESKTOP-JQDUG43'  (aw_datastore.datastore.Datastore:52)
2021-04-03 12:26:27 [INFO ]: Importing bucket aw-watcher-web-firefox  (aw_server.api:102)
2021-04-03 12:26:27 [INFO ]: Creating bucket 'aw-watcher-web-firefox'  (aw_datastore.datastore.Datastore:52)
2021-04-03 12:26:28 [INFO ]: Importing bucket aw-stopwatch  (aw_server.api:102)
2021-04-03 12:26:28 [INFO ]: Creating bucket 'aw-stopwatch'  (aw_datastore.datastore.Datastore:52)
2021-04-03 12:26:30 [WARNING]: Gap was of negative duration but could be safely merged (-0.007s). This message will only show once per batch.  (aw_transform.flood:48)
2021-04-03 12:26:30 [ERROR]: Exception on /api/0/query/ [POST]  (aw-server:1892)
Traceback (most recent call last):
  File "lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
  File "lib\site-packages\flask\app.py", line 1936, in dispatch_request
  File "lib\site-packages\flask_restx\api.py", line 339, in wrapper
  File "lib\site-packages\flask\views.py", line 89, in view
  File "lib\site-packages\flask_restx\resource.py", line 44, in dispatch_request
  File "aw_server\rest.py", line 244, in post
  File "aw_server\api.py", line 245, in query2
  File "lib\site-packages\aw_query\query2.py", line 411, in query
  File "lib\site-packages\aw_query\query2.py", line 385, in interpret
  File "lib\site-packages\aw_query\query2.py", line 134, in interpret
  File "lib\site-packages\aw_query\functions.py", line 87, in g
  File "lib\site-packages\aw_query\functions.py", line 116, in g
  File "lib\site-packages\aw_query\functions.py", line 317, in q2_categorize
  File "lib\site-packages\aw_query\functions.py", line 317, in <listcomp>
  File "lib\site-packages\aw_transform\classify.py", line 27, in __init__
  File "c:\python37-x64\lib\re.py", line 234, in compile
  File "c:\python37-x64\lib\re.py", line 286, in _compile
  File "c:\python37-x64\lib\sre_compile.py", line 764, in compile
  File "c:\python37-x64\lib\sre_parse.py", line 924, in parse
  File "c:\python37-x64\lib\sre_parse.py", line 420, in _parse_sub
  File "c:\python37-x64\lib\sre_parse.py", line 648, in _parse
re.error: multiple repeat at position 59
2021-04-03 12:26:30 [INFO ]: 500 (127.0.0.1): POST /api/0/query/ HTTP/1.1  (flask:25)
2021-04-03 12:26:47 [WARNING]: Gap was of negative duration but could be safely merged (-0.007s). This message will only show once per batch.  (aw_transform.flood:48)
2021-04-03 12:26:47 [ERROR]: Exception on /api/0/query/ [POST]  (aw-server:1892)
Traceback (most recent call last):
  File "lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
  File "lib\site-packages\flask\app.py", line 1936, in dispatch_request
  File "lib\site-packages\flask_restx\api.py", line 339, in wrapper
  File "lib\site-packages\flask\views.py", line 89, in view
  File "lib\site-packages\flask_restx\resource.py", line 44, in dispatch_request
  File "aw_server\rest.py", line 244, in post
  File "aw_server\api.py", line 245, in query2
  File "lib\site-packages\aw_query\query2.py", line 411, in query
  File "lib\site-packages\aw_query\query2.py", line 385, in interpret
  File "lib\site-packages\aw_query\query2.py", line 134, in interpret
  File "lib\site-packages\aw_query\functions.py", line 87, in g
  File "lib\site-packages\aw_query\functions.py", line 116, in g
  File "lib\site-packages\aw_query\functions.py", line 317, in q2_categorize
  File "lib\site-packages\aw_query\functions.py", line 317, in <listcomp>
  File "lib\site-packages\aw_transform\classify.py", line 27, in __init__
  File "c:\python37-x64\lib\re.py", line 234, in compile
  File "c:\python37-x64\lib\re.py", line 286, in _compile
  File "c:\python37-x64\lib\sre_compile.py", line 764, in compile
  File "c:\python37-x64\lib\sre_parse.py", line 924, in parse
  File "c:\python37-x64\lib\sre_parse.py", line 420, in _parse_sub
  File "c:\python37-x64\lib\sre_parse.py", line 648, in _parse
re.error: multiple repeat at position 59
2021-04-03 12:26:47 [INFO ]: 500 (127.0.0.1): POST /api/0/query/ HTTP/1.1  (flask:25)

From the log it seems like you have a bad regex (category rule) that apparently is able to break the UI.

We have not seen this behavior before, if you find which one of your rules it is that breaks the UI we’d love to know so we can handle it more gracefully.

It seems like “notepad++.exe” was the cause, removing it fixes the issue, I would like to have it as a category rule but it’s not a deal breaker, if there’s an alternative method to add it, let me know.

I went a few steps further to see if maybe the order or category that was the causation of the problem but to no avail.

I think if you write it as “notepad\+\+.exe” might work. + is a special character in regex which needs a character before it, not having a ordinary character before the second + probably created the error.

I created an issue of this on GitHub to get it tracked