extensions icon indicating copy to clipboard operation
extensions copied to clipboard

[Taskwarrior] fails to parse task JSON after upgrading to Taskwarrior v3.0, if you leave the old .data files behind

Open sinewalker opened this issue 1 year ago • 4 comments

Extension

https://www.raycast.com/yosy2010/raytaskwarrior

Raycast Version

1.75.2

macOS Version

14.5

Description

After upgrading to Taskwarrior v 3.0.2 and exporting/importing tasks to the new database format, the Raycast integration can no longer list my tasks:

image
  • The error message is misleading: the path to task is unchanged and set correctly:
~► which task 
/opt/homebrew/bin/task

Instead, I believe that the JSON is no longer parsing correctly with the new version of Taskwarrior. The error appears to be coming from line 23 in the api.ts file (upstream).

    const data = JSON.parse(stdout) as Task[];
    if (data) tasks = data.sort((a, b) => b.urgency - a.urgency);
  } catch (error) {
    throw new Error("Please make sure you have set the path to task in the settings");

Version 3.0 of Taskwarrior is a breaking change. The format of the task database was changed, but this should be transparent to the extension.

I think what has happened is that the task command will display this warning, which is breaking the extension:

~► task export rc.json.array:on > tasks.json
Found existing '.data' files in /Users/mjl/net/MEGA/task
  Taskwarrior's storage format changed in 3.0, requiring a manual migration.
  See https://github.com/GothenburgBitFactory/taskwarrior/releases.
Configuration override rc.json.array:on 

Workaround

  • Remove the .data files from your taskwarrior data directory

Steps To Reproduce

  1. In a system which has upgraded from Taskwarrior v2.x to v3.x, and has .data files left from the export/import
  2. Run the command "List Active Tasks"
  3. See error in Description
  4. Run the task command executed by the extension from a terminal
  5. See the error message displayed by task
  6. Remove the .data files as advised
  7. Extension working as expected

Current Behaviour

The extension errors with "Please make sure you have set the path to task in the settings" even when the path is correct

Expected Behaviour

The extension should either explicitly state there was a problem parsing the JSON output by task (rather than assume all errors are because of a misconfiguration), or produce the error thrown by the command in some sort of pop-up display, for the user to diagnose and fix.

sinewalker avatar May 31 '24 00:05 sinewalker

Thank you for opening this issue!

🔔 @AltamimiYasser you might want to have a look.

💡 Author and Contributors commands

The author and contributors of yosy2010/raytaskwarrior can trigger bot actions by commenting:

  • @raycastbot close this issue Closes the issue.
  • @raycastbot rename this issue to "Awesome new title" Renames the issue.
  • @raycastbot reopen this issue Reopens the issue.
  • @raycastbot assign me Assigns yourself to the issue.
  • @raycastbot good first issue Adds the "Good first issue" label to the issue.
  • @raycastbot keep this issue open Make sure the issue won't go stale and will be kept open by the bot.

raycastbot avatar May 31 '24 00:05 raycastbot

I have this problem with a fresh install of Taskwarrior (3.0.2). task does not display any errors, there is no .data file I could remove to work around this bug. The path is set correctly in the extension.

uhkeller avatar Jul 05 '24 14:07 uhkeller

@uhkeller Could you try running the task command which the Taskwarrior Raycast extension is running, to see what error it produces? That could reveal what the problem actually is. I suspect that if you don't have a .data file, then you did not upgrade from an earlier Taskwarrior, so you might have a different problem.

task export rc.json.array:on > tasks.json

(disclaimer: I am not the extension's creator/maintainer)

sinewalker avatar Jul 08 '24 22:07 sinewalker

Thanks for your response, @sinewalker. There is no error when running this command, just the override message Configuration override rc.json.array:on. If I disable override messages in .taskrc the message is gone from terminal output put the extension still doesn't work.

EDIT: Very weirdly, the extension intermittently does work (in about 50% of attempts) and displays my list of tasks while also showing the error message.

uhkeller avatar Jul 09 '24 05:07 uhkeller

How strange!

I wonder whether there is something causing a delay that the extension doesn't wait for? (I'm just guessing now).

Is your data.location on a network volume or something which might be intermittently slow? If so, try moving it locally and see if it helps. If not... I don't know

sinewalker avatar Jul 11 '24 11:07 sinewalker

Strange indeed. No, the data are in the default location on my SSD. I'll try to find some time to properly debug this next week.

uhkeller avatar Jul 11 '24 12:07 uhkeller

I've decided to downgrade to Taskwarrior 2 until taskwarrior-flutter and/or WingTask have caught up with TW 3. This also solves my Raycast problem for now.

uhkeller avatar Jul 12 '24 08:07 uhkeller

This issue has been automatically marked as stale because it did not have any recent activity.

It will be closed if no further activity occurs in the next 10 days to keep our backlog clean 😊

raycastbot avatar Aug 31 '24 09:08 raycastbot

This issue has been automatically closed due to inactivity.

Feel free to comment in the thread when you're ready to continue working on it 🙂

You can also catch us in Slack if you want to discuss this.

raycastbot avatar Sep 10 '24 09:09 raycastbot