.ocdata Error after drive issue

Nextcloud version : 19.0.0
Operating system and version: Ubuntu 18
Apache or nginx version: Apache 2.x
PHP version: 7.x

The issue you are facing:

I am hosting my nextcloud instance in a virtual machine on Hyper-V. A few days ago I had a diskspace issue and the virtual machine had an error. After fixing the space issue I reset the nextcloud VM and it was working just fine, or so I thought.

Now when I go to the overview in the Admin area I see the following:

It was not possible to execute the cron job via CLI. The following technical errors have appeared:
Your data directory is invalid Ensure there is a file called “.ocdata” in the root of the data directory.

If I go to my data directory, I do see a .ocdata file, so I am not sure why I am getting this error.

image

I thought it might be a database corruption issue, so I ran

occ files:scan --all and it ran through all of the files but I am still seeing the error.

Despite the error that my data directory is invalid, I have added a few things to nextcloud in the past 24 hours and it seems to be syncing just fine.

So I am wondering first if I can just fix the error I am seeing.

If not I also have a full backup of my nextcloud server AND data from about 2 weeks ago. My only concern is that if I restore that backup, that it would start deleting files on the client machines.

Thanks so much for any help that can be provided.

Is this the first time you’ve seen this error?: Yes

The output of your Nextcloud log in Admin > Logging:

Error no app in context Sabre\DAV\Exception\ServiceUnavailable: Could not open file 2020-06-22T22:58:18-0400

Error PHP fopen(/var/www/nextcloud-storage/dmoore/uploads/1747039683/00000000): failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Files/Storage/Local.php#351 2020-06-22T22:58:18-0400

Fatal webdav Sabre\DAV\Exception\BadRequest: Expected filesize of 2606609 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 737280 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side. 2020-06-22T22:56:29-0400

Error no app in context Sabre\DAV\Exception\BadRequest: Expected filesize of 2606609 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 737280 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side. 2020-06-22T22:56:29-0400

Fatal webdav Sabre\DAV\Exception\BadRequest: Expected filesize of 2665304 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 2654208 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side. 2020-06-22T22:56:29-0400

Error no app in context Sabre\DAV\Exception\BadRequest: Expected filesize of 2665304 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 2654208 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side. 2020-06-22T22:56:29-0400

Fatal webdav Sabre\DAV\Exception\ServiceUnavailable: Could not open file 2020-06-22T22:56:29-0400

Error no app in context Sabre\DAV\Exception\ServiceUnavailable: Could not open file 2020-06-22T22:56:29-0400

Error PHP fopen(/var/www/nextcloud-storage/dmoore/uploads/1747039683/00000000): failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Files/Storage/Local.php#351 2020-06-22T22:56:29-0400

Fatal webdav Sabre\DAV\Exception\ServiceUnavailable: Could not open file 2020-06-22T22:54:44-0400

Error no app in context Sabre\DAV\Exception\ServiceUnavailable: Could not open file 2020-06-22T22:54:44-0400

Error PHP fopen(/var/www/nextcloud-storage/dmoore/uploads/1747039683/00000000): failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Files/Storage/Local.php#351 2020-06-22T22:54:44-0400
Fatal webdav Sabre\DAV\Exception\ServiceUnavailable: Could not open file

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 => 'localhost', 1 => ' 2 => '', 3 => ', ), 'datadirectory' => '/var/www/nextcloud-storage', 'overwrite.cli.url' => 'http://localhost', 'dbtype' => 'mysql', 'version' => '19.0.0.12', 'dbname' => '', 'dbhost' => 'localhost', 'dbport' => '', 'dbtableprefix' => 'oc_', 'dbuser' => '', 'dbpassword' => '', 'logtimezone' => 'UTC', 'installed' => true, 'maintenance' => false, 'memcache.distributed' => '\\OC\\Memcache\\Redis', 'memcache.local' => '\\OC\\Memcache\\Redis', 'memcache.locking' => '\\OC\\Memcache\\Redis', 'redis' => array ( 'host' => 'localhost', 'port' => 6379, ), 'theme' => '', 'loglevel' => 2, 'updater.secret' => '', 'mail_smtpmode' => 'smtp', 'mail_smtpauthtype' => 'LOGIN', 'mail_smtphost' => 'smtp.1and1.com', 'mail_smtpsecure' => 'ssl', 'mail_smtpport' => '25', 'mail_from_address' => '', 'mail_domain' => '', 'mysql.utf8mb4' => true, );

I had the same issue and what solved it is by simply switching from AJAX to CRON then back to AJAX. Try it and see. Good luck.