|
| 1 | +--- |
| 2 | +title: "Taskwarrior - FAQ" |
| 3 | +--- |
| 4 | + |
| 5 | +Q: How do I remove duplicate UUIDs? |
| 6 | + |
| 7 | +If the command: |
| 8 | + |
| 9 | +``` |
| 10 | +$ task diag |
| 11 | +... |
| 12 | +``` |
| 13 | + |
| 14 | +states that there are duplicate UUIDs, how do I remove them? |
| 15 | + |
| 16 | +A: As far as I know there is no automated way to deal with duplicate UUIDs. |
| 17 | + |
| 18 | +What follows is what I would do (did) in this situation. |
| 19 | + |
| 20 | +The first thing you should do if task diag identifies one or more tasks with the same UUID is to list those tasks by using the UUID. |
| 21 | +If your UUID was 42687c6e-a5c5-45be-a6f5-5c26006abf24 then do: |
| 22 | + |
| 23 | +``` |
| 24 | +task 42687c6e-a5c5-45be-a6f5-5c26006abf24 info |
| 25 | +``` |
| 26 | + |
| 27 | +If they are identical it's likely that they got corrupted. |
| 28 | +In this situation the only thing left to do is to "get rid" of the duplicates until there is none that is identical. |
| 29 | +Read on how to fix them below. |
| 30 | + |
| 31 | +If the matching tasks are different, it's possible that they are still salvageable by assigning a new UUID that is not yet used. |
| 32 | + |
| 33 | +Fixing duplicates: |
| 34 | + |
| 35 | +Because taskwarrior uses UUIDs internally to match tasks, you won't be able to edit one task without affecting the other with same UUID. |
| 36 | +In fact the first task found with given UUID will receive all changes. |
| 37 | + |
| 38 | +In general editing your .data files by hand is not recommended. |
| 39 | +This is probably the one and only exception. |
| 40 | + |
| 41 | +With that said, make a backup of all the files in your $HOME/.task folder. |
| 42 | +Then open all your .data files in a text editor (gedit, vim, emacs... not openoffice or such), search for the UUID using the editor's find function. |
| 43 | + |
| 44 | +In the case that the tasks are identical, simply remove one of them by deleting the whole line, until there are no more duplicates. |
| 45 | +Save and run task diag again for confirmation. |
| 46 | + |
| 47 | +If on the other hand tasks are different, first find a UUID that is not taken. |
| 48 | +Start by incrementing or decrementing the rightmost number. |
| 49 | +Then confirm that no such UUID exists by running: |
| 50 | + |
| 51 | +``` |
| 52 | +task NEW-UUID all |
| 53 | +``` |
| 54 | + |
| 55 | +Once you are positive, change the UUID of one of the duplicate tasks by replacing it with the NEW-UUID. |
| 56 | + |
| 57 | +Repeat until no more duplicates exist. |
| 58 | + |
| 59 | +Wrapping up |
| 60 | + |
| 61 | +Now, if these duplicates have already been synced, you will also need to correct the database on taskd as well as on other clients. |
| 62 | + |
| 63 | +Taskd should have mechanisms in place to prevent creating tasks with duplicate UUIDs. |
| 64 | +This information requires confirmation. |
| 65 | + |
| 66 | +As far as I know the duplicate UUID problem cannot be solved by manually crafting entries in the backlog.data file. |
| 67 | + |
| 68 | +I never had to go this far, but I can only envision a road with a lot of pain! |
0 commit comments