List deleted but tasks showing up as archived and overdue

I’m currently receiving emails about overdue tasks. When I click on them and try to delete I’m informed that they’re read only because they’re archived. When I go to namespace/lists and click show archived, nothing shows up. I tried searching in the exported json file and the tasks aren’t showing up either. I’m not sure if the error is in archived lists not showing up or if they live somewhere else and are being sent as overdue.

Does the list and namespace the tasks belong to show up in the namespaces & lists overview?

I’m inferring, but they don’t. When I click “show archived” nothing appears. I can get to the tasks from the overdue tasks email by clicking on those links, but within the details of those individual tasks I can’t determine the archived list they belong to.

Does the name of the list show up either below the task title (on the task detail view) or next to the name of the task in the task overview?

It does not show up beneath task title (but does for non archived overdue tasks). The arrived tasks themselves do not show up in overview or if I search for them.

Can you check in ghe db what list (and through the list, the namespace) the task belongs to? And what their archival status is?

I’m not sure where or what that is. I’m running a docker on unRAID. The export come only had the json files. In the docket folder there’s only the config.yml and vikunja.db. am I looking within that file?

A little more info. I went into the vikunjha database. I’ll use one overdue missing task as an example. in the lists database it shows up 4 times (possibly because I tried several imports from trello, and then deleted those lists/namespaces).
I get list 8, 27, 44, 61 for list id’s. In the lists db these Id’s correspond to namespace ids, 2,3,4,5 respectively. In the namespace database, I only have 1 namespace, with ID 1. Namespaces 2,3,4,5 have all been deleted.
In the list db, there are many lists that have been archived (i.e., is_archived = 1). The only one’s that show up in the frontend when I click “show archived” are the 2 that are in that extant namespace. which I assume is as it should be. I looked at other tasks, that were in the same lists, and therefore workspaces that had been deleted and the pattern is this. All of then were marked done=0, but only the ones that keep showing up have due dates. So, if I’m understanding this right, A task with a due date, that’s not done, in a list that’s archived (is_archived=1) and a namespace that’s deleted (not in namespace db) is still being read as an overdue task. The namespace was deleted (missing), but the lists within those are not deleted (just archived) and the tasks are just labeled done/not done, due date/no due date.
hope that helps.

That sounds like the lists (with its tasks) are not properly deleted when deleting a namespace. I’ll take a look.

The underlying problem is now fixed in ea1d06bda6. You can switch to unstable to check if it works as intended.

To remove all leftovers of this, make a backup first. Then run the following sql commands:

First get all lists without a namespace:

select *
from lists
         left join namespaces n on lists.namespace_id = n.id
where n.id is null

Check to see you really don’t need the lists from this result.

To query all tasks belonging to these lists:

select *
from tasks
where list_id in (select lists.id
                  from lists
                           left join namespaces n on lists.namespace_id = n.id
                  where n.id is null)

Again, check if you really don’t need those anymore.

Once you’re ready, to delete everything run this query:

delete from task_assignees where id in (select id from tasks where list_id in (select lists.id from lists left join namespaces n on lists.namespace_id = n.id where n.id is null));
delete from favorites where kind = 1 and entity_id in (select id from tasks where list_id in (select lists.id from lists left join namespaces n on lists.namespace_id = n.id where n.id is null));
delete from label_tasks where task_id in (select id from tasks where list_id in (select lists.id from lists left join namespaces n on lists.namespace_id = n.id where n.id is null));
delete from task_attachments where task_id in (select id from tasks where list_id in (select lists.id from lists left join namespaces n on lists.namespace_id = n.id where n.id is null));
delete from task_comments where task_id in (select id from tasks where list_id in (select lists.id from lists left join namespaces n on lists.namespace_id = n.id where n.id is null));
delete from task_relations where task_id in (select id from tasks where list_id in (select lists.id from lists left join namespaces n on lists.namespace_id = n.id where n.id is null));
delete from task_reminders where task_id in (select id from tasks where list_id in (select lists.id from lists left join namespaces n on lists.namespace_id = n.id where n.id is null));
delete from tasks where list_id in (select lists.id from lists left join namespaces n on lists.namespace_id = n.id where n.id is null);
delete from lists where id in (select lists.id from lists left join namespaces n on lists.namespace_id = n.id where n.id is null);