Error while running background jobs on External Storage

This is an error that I was getting in owncloud before I transitioned over to nextcloud. I was hoping it would resolve itself after I switched but it continues to fill my log files every 15 min when my cron script runs. The error only occurs if I have modified a file on my external storage and it only occurs once. For instance, if I’ve edited and closed the file then there will be an error when cron runs but it will not throw an error the next run. I’ve tried invoking the cron.php script directly from terminal without crontab and I get the same error. I am invoking with user www-data. My external storage is configured as “Local” and there is no Authentication set. It is just a folder shared on another drive sitting on my Ubuntu server. I seem to have no trouble connecting to the storage and saving files yet the error persists.
Here is the error message from nextcloud.log

{“reqId”:“NMFNCc/WmESkcHVbQar5”,“remoteAddr”:“”,“app”:“core”,“message”:“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:26:"/Logs/custom-blacklist.txt";s:39:"\u0000OCA\Files_Versions\Command\Expire\u0000user";s:5:"steve";}): {"Exception":"OC\\User\\NoUserException","Message":"Attempted to initialize mount points for null user and no user in session","Code":0,"Trace":"#0 \/var\/www\/nextcloud\/apps\/files_versions\/lib\/storage.php(102): OC\\Files\\Filesystem::initMountPoints(false)\n#1 \/var\/www\/nextcloud\/apps\/files_versions\/lib\/storage.php(701): OCA\\Files_Versions\\Storage::getUidAndFilename(‘\/Logs\/custom-bl…’)\n#2 \/var\/www\/nextcloud\/apps\/files_versions\/command\/expire.php(61): OCA\\Files_Versions\\Storage::expire(‘\/Logs\/custom-bl…’)\n#3 \/var\/www\/nextcloud\/lib\/private\/command\/commandjob.php(34): OCA\\Files_Versions\\Command\\Expire->handle()\n#4 \/var\/www\/nextcloud\/lib\/private\/backgroundjob\/job.php(52): OC\\Command\\CommandJob->run(‘O:33:\"OCA\\\\Files…’)\n#5 \/var\/www\/nextcloud\/lib\/private\/backgroundjob\/queuedjob.php(42): OC\\BackgroundJob\\Job->execute(Object(OC\\BackgroundJob\\JobList), Object(OC\\Log))\n#6 \/var\/www\/nextcloud\/cron.php(145): OC\\BackgroundJob\\QueuedJob->execute(Object(OC\\BackgroundJob\\JobList), Object(OC\\Log))\n#7 {main}","File":"\/var\/www\/nextcloud\/lib\/private\/files\/filesystem.php","Line":377}”,“level”:3,“time”:“August 14, 2016 09:37:01”,“method”:“–”,“url”:“–”,“user”:“–”}

This appears to be the crux of the situation:

Out of interest, what sort of external storage are we talking about here? If it’s a disk is it mounted correctly against a particular user and are files and directories created against said user? How do you have it setup within NC?

Thank you for looking into this for me.
Disk is just a regular hard drive inside my Ubuntu server attached with an sata cable. It is formatted ext4.
In the next cloud web configuration I have selected to mount it as: Local Storage with no Authentication, only available to user Steve
Mount Point is /data_external
Permissions are 755 root:root
Relevant directories have permissions: 770 www-data:www-data
Files have permissions: 640 www-data:www-data
It is mounted with fstab which contains the following lines:

#####Mount External Storage:
UUID=xxxxremovedxxxxxxx /data_external ext4 defaults 0 2

Secure Shared Memory

none /run/shm tmpfs defaults,ro 0 0

#####Mount tmpfs for next cloud session management
tmpfs /var/lib/php/sessions tmpfs defaults,noatime,mode=1777 0 0

@LukasReschke @nickvergessen

Any ideas?

I just found out that this error only occurs when accessing my external storage through the ownCloud desktop client on my Mac. I’m currently running the newest version: Version 2.2.3 (build 3601).
When accessing the external storage through the web interface there are no errors.

I think I may have just solved my problem. I have my data folder located outside of my web root and after upgrading from owncloud to nextcloud there are a bunch of files in there that I may no longer need. I think the offending file may have been:

data/mount.json

After deleting that file, my errors seem to have gone away.

@steve1 this should not happen. Please open a bug report on https://github.com/nextcloud/server/issues and give more details (content of mount.json, configuration of your server).