ActivityWatch / activitywatch

The best free and open-source automated time tracker. Cross-platform, extensible, privacy-focused.
https://activitywatch.net/
Mozilla Public License 2.0
11.44k stars 521 forks source link

A day is unviewable in the activity view (500 Internal Server Error) #907

Closed douglasg14b closed 1 year ago

douglasg14b commented 1 year ago

Describe the bug

When viewing a specific day in the activity history, an exception is thrown and it's no longer viewable.

This also affects the week view, if that day is included in the week the week also throws.

The timeline view continues to work however

To Reproduce

Unknown, this only seems to happen for a single day 🤔

Expected behavior

It shows the day

Documentation

image

image

KeyError: 'title'
2023-06-24 12:45:35 [INFO ]: 500 (127.0.0.1): POST /api/0/query/ HTTP/1.1  (flask:25)
2023-06-24 12:45:49 [WARNING]: Gap was of negative duration but could be safely merged (-253.82s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:49 [WARNING]: Gap was of negative duration and could NOT be safely merged (-252.898s). This warning will only show once per batch.  (aw_transform.flood:54)
2023-06-24 12:45:52 [WARNING]: Gap was of negative duration but could be safely merged (-249.43s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:52 [WARNING]: Gap was of negative duration and could NOT be safely merged (-18591.415s). This warning will only show once per batch.  (aw_transform.flood:54)
2023-06-24 12:45:52 [WARNING]: Gap was of negative duration but could be safely merged (-883.106s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:52 [WARNING]: Gap was of negative duration and could NOT be safely merged (-264.896s). This warning will only show once per batch.  (aw_transform.flood:54)
2023-06-24 12:45:52 [WARNING]: Gap was of negative duration but could be safely merged (-0.149s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:52 [WARNING]: Gap was of negative duration and could NOT be safely merged (-440.866s). This warning will only show once per batch.  (aw_transform.flood:54)
2023-06-24 12:45:52 [WARNING]: Gap was of negative duration but could be safely merged (-253.82s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:52 [WARNING]: Gap was of negative duration and could NOT be safely merged (-252.898s). This warning will only show once per batch.  (aw_transform.flood:54)
2023-06-24 12:45:52 [WARNING]: Gap was of negative duration but could be safely merged (-211.594s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:52 [WARNING]: Gap was of negative duration and could NOT be safely merged (-316.035s). This warning will only show once per batch.  (aw_transform.flood:54)
2023-06-24 12:45:52 [WARNING]: Gap was of negative duration but could be safely merged (-488.694s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:52 [WARNING]: Gap was of negative duration but could be safely merged (-19973.136s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:53 [WARNING]: Gap was of negative duration but could be safely merged (-0.23s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:53 [WARNING]: Gap was of negative duration and could NOT be safely merged (-0.479s). This warning will only show once per batch.  (aw_transform.flood:54)
2023-06-24 12:45:53 [WARNING]: Gap was of negative duration but could be safely merged (-0.017s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:53 [WARNING]: Gap was of negative duration and could NOT be safely merged (-0.297s). This warning will only show once per batch.  (aw_transform.flood:54)
2023-06-24 12:45:53 [WARNING]: Gap was of negative duration but could be safely merged (-253.82s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:53 [WARNING]: Gap was of negative duration and could NOT be safely merged (-252.898s). This warning will only show once per batch.  (aw_transform.flood:54)
2023-06-24 12:45:53 [WARNING]: Gap was of negative duration but could be safely merged (-417.562s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:53 [WARNING]: Gap was of negative duration but could be safely merged (-249.057s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:53 [WARNING]: Gap was of negative duration and could NOT be safely merged (-257.227s). This warning will only show once per batch.  (aw_transform.flood:54)
2023-06-24 12:45:53 [WARNING]: Gap was of negative duration but could be safely merged (-226.786s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:54 [WARNING]: Gap was of negative duration but could be safely merged (-209.628s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:54 [WARNING]: Gap was of negative duration and could NOT be safely merged (-238.046s). This warning will only show once per batch.  (aw_transform.flood:54)
2023-06-24 12:45:54 [WARNING]: Gap was of negative duration but could be safely merged (-312.995s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:54 [WARNING]: Gap was of negative duration and could NOT be safely merged (-872.523s). This warning will only show once per batch.  (aw_transform.flood:54)
2023-06-24 12:45:54 [WARNING]: Gap was of negative duration but could be safely merged (-44.279s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:54 [WARNING]: Gap was of negative duration and could NOT be safely merged (-307.579s). This warning will only show once per batch.  (aw_transform.flood:54)
2023-06-24 12:45:54 [WARNING]: Gap was of negative duration but could be safely merged (-312.922s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:54 [WARNING]: Gap was of negative duration and could NOT be safely merged (-224.932s). This warning will only show once per batch.  (aw_transform.flood:54)
2023-06-24 12:45:54 [WARNING]: Gap was of negative duration but could be safely merged (-3399.861s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:54 [WARNING]: Gap was of negative duration but could be safely merged (-2311.809s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:54 [WARNING]: Gap was of negative duration but could be safely merged (-3144.679s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:58 [WARNING]: Gap was of negative duration but could be safely merged (-211.594s). This message will only show once per batch.  (aw_transform.flood:46)
2023-06-24 12:45:58 [WARNING]: Gap was of negative duration and could NOT be safely merged (-316.035s). This warning will only show once per batch.  (aw_transform.flood:54)
2023-06-24 12:45:58 [ERROR]: Exception on /api/0/query/ [POST]  (aw-server:1449)
Traceback (most recent call last):
  File "flask\app.py", line 1517, in full_dispatch_request
  File "flask\app.py", line 1503, in dispatch_request
  File "aw_server\rest.py", line 46, in decorator
  File "flask_restx\api.py", line 405, in wrapper
  File "flask\views.py", line 84, in view
  File "flask_restx\resource.py", line 46, in dispatch_request
  File "aw_server\rest.py", line 323, in post
  File "aw_server\api.py", line 310, in query2
  File "aw_query\query2.py", line 417, in query
  File "aw_query\query2.py", line 391, in interpret
  File "aw_query\query2.py", line 140, in interpret
  File "aw_query\functions.py", line 88, in g
  File "aw_query\functions.py", line 117, in g
  File "aw_query\functions.py", line 198, in q2_filter_keyvals_regex
  File "aw_transform\filter_keyvals.py", line 28, in filter_keyvals_regex
  File "aw_transform\filter_keyvals.py", line 28, in <listcomp>
  File "aw_transform\filter_keyvals.py", line 26, in predicate
KeyError: 'title'
2023-06-24 12:45:58 [INFO ]: 500 (127.0.0.1): POST /api/0/query/ HTTP/1.1  (flask:25)

Additional context

ErikBjare commented 1 year ago

The KeyError: 'title' suggests there is an event that lacks the title key.

Not sure how that's possible (unless you've messed with the no-window-titles option to aw-watcher-window, which I assume you haven't). Either way, it should definitely be handled more gracefully.

I don't see a line number in the logs, so hard to know exactly where the issue is. Could you see if there's anything above the KeyError: 'title' line?

As a workaround in the meantime: If you can find the event in the "Raw data" tab, you might be able to delete it and resolve the issue that way. (or just wait for a new release with a fix)