Background job failing at every page load

My NC log is displaying this core error every time a web page is loaded making a mess of my log .

From BUI;

Error: InvalidArgumentException: Invalid serialized command at <>
0. /var/www/nextcloud/lib/private/BackgroundJob/Job.php line 62
OC\Command\CommandJob->run("O:33:“OCA\Fil … }”)

  1. /var/www/nextcloud/lib/private/BackgroundJob/QueuedJob.php line 46
    OC\BackgroundJob\Job->execute(OC\BackgroundJob\JobList {}, OC\Log {})
  2. /var/www/nextcloud/cron.php line 148
    OC\BackgroundJob\QueuedJob->execute(OC\BackgroundJob\JobList {}, OC\Log {})

From logfile;

{“reqId”:“fRroZbkT92tupnn4oqHq”,“level”:3,“time”:“2021-03-28T15:32:44+00:00”,“remoteAddr”:“192.168.1.1”,“user”:"–",“app”:“core”,“method”:“GET”,“url”:"/nextcloud/cron.php",“message”:{“Exception”:“InvalidArgumentException”,“Message”:“Invalid serialized command”,“Code”:0,“Trace”:[{“file”:"/var/www/nextcloud/lib/private/BackgroundJob/Job.php",“line”:62,“function”:“run”,“class”:“OC\Command\CommandJob”,“type”:"->",“args”:[“O:33:“OCA\Files_Versions\Command\Expire”:2:{s:43:”\u0000OCA\Files_Versions\Command\Expire\u0000fileName";s:42:"/Photos/2007/2007_11_Tday2007/HPIM3254.JPG";s:39:"\u0000OCA\Files_Versions\Command\Expire\u0000user";s:5:“scott”;}"]},{“file”:"/var/www/nextcloud/lib/private/BackgroundJob/QueuedJob.php",“line”:46,“function”:“execute”,“class”:“OC\BackgroundJob\Job”,“type”:"->",“args”:[{“class”:“OC\BackgroundJob\JobList”},{“class”:“OC\Log”}]},{“file”:"/var/www/nextcloud/cron.php",“line”:148,“function”:“execute”,“class”:“OC\BackgroundJob\QueuedJob”,“type”:"->",“args”:[{“class”:“OC\BackgroundJob\JobList”},{“class”:“OC\Log”}]}],“File”:"/var/www/nextcloud/lib/private/Command/CommandJob.php",“Line”:37,“CustomMessage”:“Error while running background job (class: OC\Command\CommandJob, arguments: O:33:“OCA\Files_Versions\Command\Expire”:2:{s:43:”\u0000OCA\Files_Versions\Command\Expire\u0000fileName";s:42:"/Photos/2007/2007_11_Tday2007/HPIM3254.JPG";s:39:"\u0000OCA\Files_Versions\Command\Expire\u0000user";s:5:“scott”;})"},“userAgent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”,“version”:“19.0.6.2”}

I’d like to upgrade NC but need to clean-up this before doing so.

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

[/details]

Nextcloud version (eg, 20.0.5): 19.0.6
Operating system and version (eg, Ubuntu 20.04): Ubuntu 18.04.5 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.29
PHP version (eg, 7.4): 7.2.33

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N):

Steps to replicate it:

The output of your Nextcloud log in Admin > Logging:

PASTE HERE

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

PASTE HERE

The output of your Apache/nginx/system log in /var/log/____:

PASTE HERE

Turned out oc_jobs contained over 8600 entries mosttly associated with the version app which I stopped using long ago. Apparently, there was a corrupt one in the table somewhere (top?) that was casing cron.php to abend. Being the mysql hack that I am, I took the hammer to it and truncated the table.