Read and tick the following checkbox after you have created the issue or place an x inside the brackets ;)
I see the following in the Nextcloud Log: ArgumentCountError: Too few arguments to function
Explain what you did to encounter the issue
{ "Exception": "ArgumentCountError",
"Message": "Too few arguments to function OCA\\News\\Cron\\Updater::run(), 0 passed and exactly 1 expected",
"Code": 0,
"Trace":
[
{ "function": "run",
"class": "OCA\\News\\Cron\\Updater",
"type": "::",
"args":[]
},
{ "file": "/srv/nextcloud/lib/private/BackgroundJob/Legacy/RegularJob.php",
"line": 32,
"function": "call_user_func",
"args": [
[ "OCA\\News\\Cron\\Updater","run"]
]
},
{ "file": "/srv/nextcloud/lib/private/BackgroundJob/Job.php",
"line": 61,
"function": "run",
"class": "OC\\BackgroundJob\\Legacy\\RegularJob",
"type": "->",
"args": [
[ "OCA\\News\\Cron\\Updater","run"]
]
},
{ "file": "/srv/nextcloud/cron.php",
"line": 125,
"function": "execute",
"class": "OC\\BackgroundJob\\Job",
"type": "->",
"args": [
{ "__class__": "OC\\BackgroundJob\\JobList" },
{ "__class__": "OC\\Log" }
]
}
],
"File": "/srv/nextcloud/apps/news/lib/Cron/Updater.php",
"Line": 46,
"CustomMessage": "Error while running background job (class: OC\\BackgroundJob\\Legacy\\RegularJob, arguments: Array\n(\n [0] => OCA\\News\\Cron\\Updater\n [1] => run\n)\n)"
},
"userAgent":"--",
"version":"18.0.1.3"}
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Could anyone please post what the following statement outputs for a working News instance?
select * from oc_jobs where class like '%News%';
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
@onkeljuergen I have the same problem after upgrading NextCloud and News to the newest stable version today. News stopped downloading.
MariaDB [owncloud]> select * from oc_jobs where class like '%News%';
+-------+-----------------------+----------+------------+--------------+-------------+--------------------+
| id | class | argument | last_run | last_checked | reserved_at | execution_duration |
+-------+-----------------------+----------+------------+--------------+-------------+--------------------+
| 30017 | OCA\News\Cron\Updater | null | 1586189702 | 1586233801 | 0 | 38 |
+-------+-----------------------+----------+------------+--------------+-------------+--------------------+
Hi,
yes it looks the same for me. So I could not find out what the actual problem was.
News works reasonably ok at the moment. But still I hope this will get fixed soon :-(
FYI: This is my complete log message(s) from the current cron job (linux cron job every 5 mins; Debian Stretch; PHP 7.4.4).
{
"reqId": "4CRzolL7zAp39dWvkuvG",
"level": 3,
"time": "2020-04-10T12:45:01+02:00",
"remoteAddr": "",
"user": "--",
"app": "PHP",
"method": "",
"url": "--",
"message": "call_user_func() expects parameter 1 to be a valid callback, non-static method OCA\\News\\Cron\\Updater::run() should not be called statically at /lib/private/BackgroundJob/Legacy/RegularJob.php#32",
"userAgent": "--",
"version": "18.0.3.0"
}
{
"reqId": "4CRzolL7zAp39dWvkuvG",
"level": 3,
"time": "2020-04-10T12:45:01+02:00",
"remoteAddr": "",
"user": "--",
"app": "core",
"method": "",
"url": "--",
"message": {
"Exception": "ArgumentCountError",
"Message": "Too few arguments to function OCA\\News\\Cron\\Updater::run(), 0 passed and exactly 1 expected",
"Code": 0,
"Trace": [
{
"function": "run",
"class": "OCA\\News\\Cron\\Updater",
"type": "::"
},
{
"file": "/lib/private/BackgroundJob/Legacy/RegularJob.php",
"line": 32,
"function": "call_user_func"
},
{
"file": "/lib/private/BackgroundJob/Job.php",
"line": 61,
"function": "run",
"class": "OC\\BackgroundJob\\Legacy\\RegularJob",
"type": "->"
},
{
"file": "/cron.php",
"line": 125,
"function": "execute",
"class": "OC\\BackgroundJob\\Job",
"type": "->"
}
],
"File": "/apps/news/lib/Cron/Updater.php",
"Line": 46,
"CustomMessage": "Error while running background job (class: OC\\BackgroundJob\\Legacy\\RegularJob, arguments: Array\n(\n [0] => OCA\\News\\Cron\\Updater\n [1] => run\n)\n)"
},
"userAgent": "--",
"version": "18.0.3.0"
}
_#thx4fixing_
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
I checked the log of my instance today and saw the same error, it doesn't seem to have any effect on news.
So I checked https://docs.nextcloud.com/server/18/developer_manual/app/backgroundjobs.html
and compared it to
lib/Cron/Updater.php
seems to me that there is no change but maybe my PHP is not good enough
Then in the info.xml is a job definition without an argument which will then pass an empty array according to the docs
This should be fixed in 14.2.0+
Error still occurs, in 14.2.0 I think after we are now using exactly what I could find in the documentation, it could be an issue in the server itself or we are doing something wrong.
I think the issue is with dependency injection failing sometimes. That would also explain some of the issues I've been having with the service migration.
Am seeing this error after upgrading php to 7.4.
Same for me, just updated php to 7.4 and got hit by that same issue, news is currently unusable for me as it's not updating any feeds from cron. It works though if I'll run '/usr/bin/php -f /var/www/nextcloud/cron.php' manually on server, then feeds are being updated. With php 7.3 there were no issues with that.
I'm not sure if this can have anything to do with that problem (not a php programmer), but I've found this, maybe it'll help somehow here:
https://www.php.net/manual/en/migration74.deprecated.php
Unbinding $this when $this is used
Unbinding $this of a non-static closure that uses $this is deprecated.
Same issue here with Nextcloud 19.0.4, news 14.2.2 and php 7.4.

In lib/private/BackgroundJob/Legacy/RegularJob.php, I have added the missing null argument:
// This "if" was added:
if (count($argument) == 2) {
array_push($argument, null);
}
// This is the existing code:
if (is_callable($argument)) {
call_user_func($argument);
}
That appears to resolve the issue. I can submit a PR to the NC server project, but I'd like confirmation from someone familiar with the server and/or News app that it is the correct resolution. I also noticed in the README that argument is sometimes (?) not null in the DB, which makes me wonder if I should simply update my DB record.
You can make a PR to the server, but I'm not sure if they'll accept changes to legacy components. In the meantime news switched away from the legacy job for the version that supports NC 20, so this issue should resolve itself eventually.
Fair enough. I won't bother to submit it then. Anyone who stumbles across this issue can make the change manually if they're not ready/able to upgrade to NC 20.
There's now an update of the app and @chriswells0 has a fix for people who can't update, closing
Most helpful comment
In
lib/private/BackgroundJob/Legacy/RegularJob.php, I have added the missingnullargument:That appears to resolve the issue. I can submit a PR to the NC server project, but I'd like confirmation from someone familiar with the server and/or News app that it is the correct resolution. I also noticed in the README that
argumentis sometimes (?) not null in the DB, which makes me wonder if I should simply update my DB record.