Using re: in the description creates and recurring task with empty interval
To report a bug...
-
What command(s) did you run?
task next -
What did you expect to happen? I'd be presented with my list of to-do items from the next report.
-
What actually happened? Received the following output:
The recurrence value '' is not valid.No report output.
I tried a few additional things to see if I could get my list of tasks back ...
-
I restored from my backup from a working day a couple days ago, ran task and received the same error.
-
I figured out, however, if I changed my system clock back to yesterday's date, however, that
task nextjust fine. -
I tried setting the date forward to tomorrow, to see if time will just sort of fix this error on it's own, and unfortunately it's still generating the same error/behavior.
-
I have yet to be able to determine which recurring task in my data is causing this to happen, especially since the value is presented as, apparently, a null string.
-
Paste the output of the
task diagcommand.
task 2.5.1
Platform: FreeBSD
Compiler
Version: 4.2.1 Compatible FreeBSD Clang 8.0.0 (tags/RELEASE_800/final 356365)
Caps: +stdc +stdc_hosted +ILP32 +c8 +i32 +l32 +vp32 +time_t64
Compliance: C++11
Build Features
Built: Jan 12 2020 02:09:36
CMake: 3.15.5
libuuid: libuuid, no uuid_unparse_lower
libgnutls: 3.6.11
Build type: Release
Configuration
File: /home/mercadal/.taskrc (found), 1648 bytes, mode 100644
Data: /home/mercadal/.task (found), dir, mode 40755
Locking: Enabled
GC: Enabled
$EDITOR: vi
Server:
Trust: strict
Certificate: , not readable, 0 bytes
Key: , not readable, 0 bytes
Ciphers: NORMAL
Creds:
Hooks
System: Enabled
Location: /home/mercadal/.task/hooks
(-none-)
Tests
$TERM: xterm (175x62)
Dups: Scanned 375 tasks for duplicate UUIDs:
No duplicates found
Broken ref: Scanned 375 tasks for broken references:
No broken references found
I think I have a working theory as to how this error was triggered:
I set my clock back to yesterday, so I could continue to do anything in the task commands to list/look at entries: It appears I had created a parent, recurring task without a recurrence value.
Name Value
ID 115
Description get back to xxxxxxx xxxxxx program if xxxxxxx did not already
Status Recurring
Mask +
Entered 2020-02-05 13:59:06 (21h)
Due 2020-02-07 00:00:00
Last modified 2020-02-06 10:04:04 (1h)
Tags work
Virtual tags DUE MONTH PARENT TAGGED TOMORROW UDA UNBLOCKED WEEK YEAR PRIORITY
UUID 95496da7-4849-11ea-9d40-b827eb5ebf17
Urgency 13.26
Priority M
tags 0.8 * 1 = 0.8
due 0.713 * 12 = 8.56
UDA priority.M 1 * 3.9 = 3.9
------
13.26
Date Modification
2020-02-05 13:59:07 Mask set to '-'.
2020-02-06 10:04:04 Mask changed from '-' to '+'.
Yesterday I had marked done the task generated by this recurring parent; I believe that caused task to begin to generate this error today.
Unlike other parent tasks, this one appears to be missing a value altogether for Recurrence, both in this info record, and also in the underlying data file. No empty string... just no key/value pair for "recur" at all.
I can't figure out what command I typed when I first entered this task that could have made such a record... so I can't reproduce it to propose a fix. That might make this bug only an academic exercise at this point, so I'm closing it.
Sorry, but to me this looks like a serious bug.
No sense in closing this.
An absence of recurrence date must not under any circumstance inflict a global dysfunction on task!!!
Please reopen.
Please fix this!
I figured out how I made this issue happen.
Since I can reproduce, and given @corbolais 's feedback, I'm reopening — it is a pretty nasty bug. When it first hit me, I couldn't fix by using backups, and I was afraid I'd have to dump all my tasks that I had entrusted to taskwarrior.
I haven't had a chance to look at the code to make a more specific recommendation as of yet, but I would imagine there could be some kind of error check before creating a recurring task with no recurrence period value.
Background on how I made it fail ... I regularly abbreviate the word 'regarding' as 're:' when making notes to myself — such as "call Bob re: shoveling my sidewalk while out of town" It's a muscle memory thing. takswarrior interprets this as an abbreviation for a recurring task request, but creates it with no recurrence value, instead of saying it's an invalid value for recurrence.
Reproduction steps:
- Example command:
task add get back to D re: billable rate +pers pri:H - This generated a record like the following:
{"description":"get back to D billable rate","due":"20200218T050000Z","entry":"20200213T160737Z","modified":"20200213T160737Z","priority":"H","status":"recurring","tags":["pers"],"uuid":"f3e864fe-4e7a-11ea-b5b6-b827eb5ebf17"} - Find the pending task generated by the parent in next (or wherever) and mark it done.
- Wait till the next day (or set your clock forward one day);
task next(or virtually every other command) will fail with the recurrence error.The recurrence value '' is not valid. - It's a bit of trouble, since you now can't run reports to figure out which record is broken. Fix by going back to the past and removing the invalid parent record.
Thank you for the detailed report, adding this one on our list of parser issues. @corbolais good call with reopening, this might have slipped through the fingers otherwise :slightly_smiling_face:
@charlesmercadal Despite very good instructions, I actually cannot reproduce this on 2.5.1. Do you have a way to double check the issue description that triggers this?
$ task add get back to D re: billable rate +pers pri:H
Created task 17.
$ task 17 info
Name Value
ID 17
Description get back to D billable rate
Status Pending
Project Inbox
Entered 2020-11-30 11:31:20 (15s)
Last modified 2020-11-30 11:31:20 (15s)
Tags pers
Virtual tags PENDING READY TAGGED UDA UNBLOCKED LATEST PROJECT PRIORITY
UUID be10a493-f7a9-4749-abf6-64d55271f79f
Urgency 3
Priority H
Type task
UDA priority.H 1 * 3 = 3
------
3
$ task version
task 2.5.1 built for linux
...
You can see the task did not end up in the recurring state, but 're: ' seems to have disappeared from the description completely.
I missed a step in the reproduction steps above: I couldn't reproduce the creation of a recurring task without a recur period till I added a due date, as per the below:
testacct@rpi2:~ % task version
A configuration file could not be found in
Would you like a sample /home/testacct/.taskrc created, so Taskwarrior can proceed? (yes/no) y
task 2.5.1 built for freebsd
Copyright (C) 2006 - 2016 P. Beckingham, F. Hernandez.
Taskwarrior may be copied only under the terms of the MIT license, which may be found in the Taskwarrior source kit.
Documentation for Taskwarrior can be found using 'man task', 'man taskrc', 'man task-color', 'man task-sync' or at
http://taskwarrior.org
testacct@rpi2:~ % task add get back to D re: billable rate +pers pri:H due:Fri
testacct@rpi2:~ % task next
ID Age P Tag Due Description Urg
2 - H pers 3d get back to D billable rate 14
1 task
Creating recurring task instance 'get back to D billable rate'
testacct@rpi2:~ % task next
ID Age P Tag Due Description Urg
2 9s H pers 3d get back to D billable rate 14
1 task
testacct@rpi2:~ % task 2 info
Name Value
ID 2
Description get back to D billable rate
Status Pending
Parent task c224aa5d-3333-11eb-a501-b827eb5ebf17
Mask Index 0
Entered 2020-11-30 12:44:59 (18s)
Due 2020-12-04 00:00:00
Last modified 2020-11-30 12:44:55 (22s)
Tags pers
Virtual tags CHILD DUE PENDING READY TAGGED UDA UNBLOCKED WEEK YEAR LATEST PRIORITY
UUID c41b37ed-3333-11eb-a501-b827eb5ebf17
Urgency 14.01
Priority H
tags 0.8 * 1 = 0.8
due 0.601 * 12 = 7.21
UDA priority.H 1 * 6 = 6
------
14.01
testacct@rpi2:~ % cat .task/backlog.data
{"description":"get back to D billable rate","due":"20201204T050000Z","entry":"20201130T174455Z","modified":"20201130T174455Z","priority":"H","status":"recurring","tags":["pers"],"uuid":"c224aa5d-3333-11eb-a501-b827eb5ebf17"}
{"description":"get back to D billable rate","due":"20201204T050000Z","entry":"20201130T174459Z","imask":0,"modified":"20201130T174455Z","parent":"c224aa5d-3333-11eb-a501-b827eb5ebf17","priority":"H","status":"pending","tags":["pers"],"uuid":"c41b37ed-3333-11eb-a501-b827eb5ebf17"}
{"description":"get back to D billable rate","due":"20201204T050000Z","entry":"20201130T174455Z","mask":"-","modified":"20201130T174459Z","priority":"H","status":"recurring","tags":["pers"],"uuid":"c224aa5d-3333-11eb-a501-b827eb5ebf17"}
I still have no luck reproducing this, here is the same sequence of steps using 2.5.1 on Ubuntu 20.04:
root@799730228f65:/# task
A configuration file could not be found in
Would you like a sample /root/.taskrc created, so Taskwarrior can proceed? (yes/no) yes
No matches.
root@799730228f65:/# task version
task 2.5.1 built for linux
...
root@799730228f65:/# task add get back to D re: billable rate +pers pri:H due:Fri
Created task 1.
root@799730228f65:/# task next
ID Age P Tag Due Description Urg
1 - H pers 3d get back to D billable rate 13.8
1 task
root@799730228f65:/# task next
ID Age P Tag Due Description Urg
1 - H pers 3d get back to D billable rate 13.8
1 task
root@799730228f65:/# task 2 info
No matches.
root@799730228f65:/# cat /root/.task/backlog.data
{"description":"get back to D billable rate","due":"20201211T000000Z","entry":"20201207T023929Z","modified":"20201207T023929Z","priority":"H","status":"pending","tags":["pers"],"uuid":"6095f324-6426-4d29-9957-773cc0279f1a"}
I'm not sure why this one isn't reproducible; I copied the last items directly out of my terminal. Something environment specific on my end perhaps?
As an alternative, rather than chasing down the parser bug for the time being, could the error message generated by a task without a recurrence value on respawn (e.g., The recurrence value '' is not valid.) be improved to show task UUID (like, The recurrence value '' for task c224aa5d is not valid.)? If I had had that data, I could have potentially done a task delete c224aa5d on it and resumed seeing the rest of my tasks/using taskwarrior, but figuring out which item was the offending record was rather a challenge in a production list of data.
I'm deeply rusty on my C++ skills, so I'm not sure if my brief review of the code is accurate that follows: the only challenge I see to adding additional task information for the error message is that the getNextRecurrence method is only passed a variable of type Datetime and a string with the recurrence period. I expect it would also need to be passed the UUID for error message purposes. But it appears the method has a couple other error messages that might benefit from identifying the errant record.
Error message: That's a good feedback. I think it applies to all sorts of error messages in task (simply because they often bubble up from internals). Possibly a better exception handling could resolve this.
As far as the bug itself goes, assuming you're still able to reproduce this on your machine, perhaps you could upgrade to 2.5.3 release and see if the problem still occurs?
Looks like I'm unable to reproduce in 2.5.3. I'm guessing something has changed the parser — I get an unrelated error, in this case about the validity of my due date, but it looks like I can't create another problem record as before:
testacct@rpi2:~/task-2.5.3/src % ./task version
A configuration file could not be found in
Would you like a sample /home/testacct/.taskrc created, so Taskwarrior can proceed? (yes/no) y
task 2.5.3 built for FreeBSD
Copyright (C) 2006 - 2021 P. Beckingham, F. Hernandez.
Taskwarrior may be copied only under the terms of the MIT license, which may be
found in the Taskwarrior source kit.
Documentation for Taskwarrior can be found using 'man task', 'man taskrc', 'man
task-color', 'man task-sync' or at http://taskwarrior.org
testacct@rpi2:~/task-2.5.3/src % ./task add get back to D re: billable rate +pers pri:H due:Fri
'Fri' is not a valid date in the 'Y-M-D' format.