Content view publish "no route matches" error

when I try to publish centos 8 content view , it got stuck and I tried a few times, more tasks stuck , tried stop/cancel them , didn’t work. I removed the tasks from database,

su - postgres
psql foreman
delete from foreman_tasks_tasks where id in(select id from foreman_tasks_tasks where state = 'stopped' and result = 'error');

but after that when I try to publish the content view , got this error:

No route matches {:action=>“show”, :controller=>“foreman_tasks/tasks”, :id=>nil}, missing required keys: [:id]

this is both on CentOS-8 content view , tried regenerate repository metadata, this works, but publish or promote the latest version got this error.

> rpm -q foreman katello
>  cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

Please, never ever just go into the db and delete stuff. Almost surely you will leave some orphaned records around, which can lead to issues just like the one you’re having now.

If you insist on removing tasks, please use the provided tooling for doing so. In this case it is the foreman_tasks:cleanup rake task.

Luckily, it removes tasks related orphaned records when it runs so you can use it even now to get your system into working shape.

foreman-rake rake foreman_tasks:cleanup TASK_SEARCH="label = this-label-definitely-does-not-exist"

Running it like this will make it not match any tasks and only perform the cleanup of orphaned records.