From a read of the source code it looks like this error could happen if a scheduled task was missing the corresponding row in mdl_task_scheduled in the database.
If this error happens when you're trying to run or access a specific task, you could use this query, e.g. to check task \logstore_standard\task\cleanup_task:
SELECT * FROM mdl_task_scheduled WHERE classname = '\\logstore_standard\\task\\cleanup_task';
(Double-backslashes required in MySQL/MariaDB).
If the error occurs when the affected task isn't obvious, e.g. on the Scheduled task page, you might need to modify the source code to get the affected task reported. You could modify admin/tool/task/renderer.php adding line 82 below to send the task's class name to the web server error log:
79 foreach ($tasks as $task) {
80 $classname = get_class($task);
81 $defaulttask = \core\task\manager::get_default_scheduled_task($classname, false);
82 if (!$defaulttask) error_log("Task: $classname");