# Occasional cron.php error

**URL:** <https://help.nextcloud.com/t/occasional-cron-php-error/157714>\
**Category:** ℹ️ Support\
**Created:** [March 13, 2023, 1:50pm UTC](https://help.nextcloud.com/t/occasional-cron-php-error/157714 "2023-03-13T13:50:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sshowers](https://help.nextcloud.com/user_avatar/help.nextcloud.com/sshowers/32/49767_2.png) [@sshowers](https://help.nextcloud.com/u/sshowers)\
**Post date:** [March 13, 2023, 1:50pm UTC](https://help.nextcloud.com/t/occasional-cron-php-error/157714/1 "2023-03-13T13:50:53Z")

</div>

Nextcloud version _(eg, 20.0.5)_: 25.0.4  
Operating system and version _(eg, Ubuntu 20.04)_: RockyLinux 8.7  
Apache or nginx version _(eg, Apache 2.4.25)_: 2.4.37-51  
PHP version _(eg, 7.4)_: 8.1.16

The issue you are facing:  
Approximately twice per day receiving the follwing E-mail from cron daemon:

```auto
ValueError: min(): Argument #1 ($value) must contain at least one element in /var/www/html/nextcloud/apps/dav/lib/BackgroundJob/UserStatusAutomation.php:142
Stack trace:
#0 /var/www/html/nextcloud/apps/dav/lib/BackgroundJob/UserStatusAutomation.php(142): min()
#1 /var/www/html/nextcloud/lib/public/BackgroundJob/Job.php(78): OCA\DAV\BackgroundJob\UserStatusAutomation->run()
#2 /var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php(103): OCP\BackgroundJob\Job->start()
#3 /var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php(93): OCP\BackgroundJob\TimedJob->start()
#4 /var/www/html/nextcloud/cron.php(152): OCP\BackgroundJob\TimedJob->execute()
#5 {main}

```

Is this the first time you’ve seen this error? _(Y/N)_:  
Yes (new install).

The contents of /etc/cron.d/nextcloud:

````auto
# NextCloud background jobs...
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
*/15 * * * * apache php -f /var/www/html/nextcloud/cron.php
```

The output of your Nextcloud log in **Admin > Logging** :
```
{"reqId":"yYJIZDzUDCHb4wq4nFjU","level":3,"time":"2023-03-13T10:15:01+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"min(): Argument #1 ($value) must contain at least one element","userAgent":"--","version":"25.0.4.1","exception":{"Exception":"ValueError","Message":"min(): Argument #1 ($value) must contain at least one element","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/apps/dav/lib/BackgroundJob/UserStatusAutomation.php","line":142,"function":"min"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/Job.php","line":78,"function":"run","class":"OCA\\DAV\\BackgroundJob\\UserStatusAutomation","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":103,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":93,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/html/nextcloud/cron.php","line":152,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/html/nextcloud/apps/dav/lib/BackgroundJob/UserStatusAutomation.php","Line":142,"CustomMessage":"--"},"id":"640f276392c70"}
```

The output of your config.php file in `/path/to/nextcloud` (make sure you remove any identifiable information!):
```
<?php
$CONFIG = array (
  'instanceid' => ' ************',
  'passwordsalt' => ' *********************************',
  'secret' => ' **********************************',
  'trusted_domains' =>
  array (
    0 => 'nc.domain.com',
  ),
  'datadirectory' => '/data/nextcloud',
  'dbtype' => 'mysql',
  'version' => '25.0.4.1',
  'overwrite.cli.url' => 'http://nc.domain.com',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:9999',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => ' *********',
  'dbpassword' => ' ***************',
  'installed' => true,
  'mail_from_address' => 'reports',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'domain.com',
  'mail_smtphost' => '999.99.99.99',
  'default_phone_region' => 'US',
  'force_locale' => 'en_US',
  'filelocking.enabled' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
    'timeout' => 0.0,
  ),
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
);
```

The output of your Apache/nginx/system log in `/var/log/httpd/error_log`:
```
No errors appear in the Apache log at the time of the cron messages
```

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.
```
{"reqId":"ZAn5ekGGrvlFbdNcNdxzQgAAAEA","level":2,"time":"2023-03-09T15:21:30+00:00","remoteAddr":"192.168.10.75","user":"--","app":"no app in context","method":"GET","url":"/","message":"Could not
detect any host in http:///data/htaccesstest.txt","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0","version":"","data":[]}
{"reqId":"ZAn5ekGGrvlFbdNcNdxzQgAAAEA","level":2,"time":"2023-03-09T15:21:30+00:00","remoteAddr":"192.168.10.75","user":"--","app":"no app in context","method":"GET","url":"/","message":"Could not
detect any host in https:///data/htaccesstest.txt","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0","version":"","data":[]}
{"reqId":"ZAn7lRJ56uP3JBbaHaydUwAAAII","level":2,"time":"2023-03-09T15:30:29+00:00","remoteAddr":"192.168.10.75","user":"--","app":"no app in context","method":"POST","url":"/index.php","message":"
Could not detect any host in http:///data/htaccesstest.txt","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0","version":"","data":[]}
{"reqId":"ZAn7lRJ56uP3JBbaHaydUwAAAII","level":2,"time":"2023-03-09T15:30:29+00:00","remoteAddr":"192.168.10.75","user":"--","app":"no app in context","method":"POST","url":"/index.php","message":"
Could not detect any host in https:///data/htaccesstest.txt","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0","version":"","data":[]}
```
````

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 14, 2024, 12:08pm UTC](https://help.nextcloud.com/t/occasional-cron-php-error/157714/2 "2024-12-14T12:08:08Z")

</div>


