-
-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot sync: runtime error - invalid memory address or nil pointer dereference #228
Comments
I'll spin up a fresh 22.04 today to test this. Can you try deleting your '/home/username/.cache/todoist/'directory to see if this makes a difference? (No Tilda on the Apple Keyboard apparently) |
Thanks for the response!
I just tried this; it had no effect. I still got the same error. As a sidenote: I did not need to re-enter my API-token after deleting this cache, I assume that is stored elsewhere (just asking to make sure I removed the proper directory and it had the proper effect)? |
The API token is stored in Do you know roughly how many projects and tasks you have in your account? I have ~100 projects with ~1100 tasks for comparison. |
Roughly 3700 tasks, 170 projects |
Looking at this stack trace more closely, the line in question seems to be dereferencing a nil pointer. I'm not super familiar with this code, but what seems to be going on is that the My guess is that this is a data issue that the todoist (cli) code is not handling properly and not an issue with your OS or configuration or number of projects/tasks. But without your actual todoist data, it's hard to figure out exactly what is causing this. Would you be open to helping troubleshoot this locally on your machine? Since you already have a go dev environment set up you could add some |
I only have a setup with ~20 projects and ~1000 tasks, so I may not be able to reproduce this, but that shouldn't be exceeding any memory limits. I just pulled the latest binary from GitHub on a fresh install of 22.04.2 and it syncs without issue. I followed the steps outlined. I will note this is a server (read: no GUI) install of Ubuntu 22.04. Before adding some Println statements, could you try running with the I'm guessing it'll crash before it gets to any debug statements, but it's worth a shot. |
Sure, never programmed in Go before, but I gave it a try. It seems to me like its the child of a completed task. The parent task is completed, but one of its children isn't. And it also isn't counted, since it says 7/7, but I count 8 myself. I guess my todoist data itself is broken, resulting in a situation that should be impossible.
Maybe no longer relevant, but I did it anyway: I did get some debug info with a request (containing probably sensitive cookie info, so I did not screenshot it) and a response. Afterwards the crash. |
Good point, I forgot it dumps the API calls, which include your sync key. My mistake there. That should probably be fixed, haha! I'll see if I can reproduce your data set here to see if I can at least reproduce the crash. I don't think that's an impossible scenario. Unrelated, I'm really curious what you were making with spinach and smoked chicken, haha! |
Thanks for troubleshooting! This is a pretty plausible theory. Fairly certain that this situation would cause a crash. I think the official Todoist clients automatically mark all child tasks as completed, but that might not be enforced by the API and if you are using the todoist cli to update projects then your task data might wind up in this bad state. Would be interesting if you are able to repro this @HacDan. |
I can say for pretty much certain you cannot reproduce this exact scenario with the web or desktop client (under normal network conditions). One thing I missed at an initial glance was the 7/7 completed subtasks, but there is the obvious 8th item that is not marked complete. I will say that it's possible to have a parent task complete with subtasks not complete and that's handled fine. The main distinction here is the count displayed. I'll play around with the API directly to see if can reproduce the task that way. |
FYI the way the sync process works like this:
The crash is occurring in step 2. |
To clarify you mean that it's handled fine by the official web clients and not by todoist cli, right :) |
I do not actually. I was able to process a sync without issue with the CLI. I didn't test on 22.04, but I'm sitting on a 20.04 machine currently and sync occurred without issue. I believe the issue here to be a technically impossible state from official clients. |
It's possible that this wasn't handled properly in the past by the official clients and changed more recently. Another possible cause is using the todoist CLI to change the state of subtasks -- I haven't checked to see how the CLI handles closing tasks with open subtasks, that could be a bug too. |
Some extra information, in case this might be useful: I have only used the API/CLI for adding tasks, never for completing. So this completion was done via either the official web-client or the (iphone) app. Also: this list is shared with several other todoist accounts. This particular item was added on '1 Dec 2021 · 10:09 AM' and probably completed a few days later (most likely by some other todoist-account with whom this project was shared, I can check, but the 'load more history' button goes back 1 week at a time, so I would rather not since that is going to take some time😁). |
Even when using Curl directly with the API I was not able to reproduce this exact scenario. I'd say your best bet for resolving this is to check off that task or delete it from the grocery list. This is hopefully a one-off situation. |
I did, and I encountered 3 more cases, the last 'completed' list even had 2 uncompleted items (20 completed, 2 uncompleted). I completed all the tasks. And now things are working again for me. Thanks for the help! |
My guess is that this is due to some behavior that was there in the past (back in 2021) that was since fixed by Todoist. It probably wouldn't hurt for us to add some assertions in the code to check for this so that if it does happen to other users they know what to do -- there are a couple of other bug reports here in GitHub where people reported sync issues, and I wonder if they have the same cause. |
My OS: Ubuntu 22.04.2 LTS
When running the most recent binary, I cannot sync. I had the same problem on the previous 2 binaries. Am I doing something wrong? If not: I have a large amount of projects and tasks in my todoist. Could this be a problem?
I ran the following commands:
Resulted in:
I get the same error when cloning the repository and building it myself:
The text was updated successfully, but these errors were encountered: