Nextcloud Self-hosted Sabre\DAV\Exception\BadRequest error

Hello !

I love Nextcloud, but my experience how to be seriously spoiled by a recurring problem, so I ask the help of this forum to try to solve it.

I have done 3 or 4 fresh Nextcloud installations on the same machine, and the same problem happens again, namely that when there is an upload of a file like a SVG or a ZIP, the uploader will stop, and start running in circles, displaying that the upload could not be done, then trying the upload again.
And so on and so forth.

The error I get is the following (from Nextcloud’s admin interface):

[webdav] Fatal: Sabre\DAV\Exception\BadRequest: expected filesize 8414609 got 1802240 at <<closure>>

 0. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php line 156
    OCA\DAV\Connector\Sabre\File->put(null)
 1. /var/www/nextcloud/apps/dav/lib/Upload/UploadFolder.php line 45
    OCA\DAV\Connector\Sabre\Directory->createFile("00000001", null)
 2. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1096
    OCA\DAV\Upload\UploadFolder->createFile("00000001", null)
 3. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 525
    Sabre\DAV\Server->createFile("uploads/redscap ... 1", null, null)
 4. <<closure>>
    Sabre\DAV\CorePlugin->httpPut(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
 5. /var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    undefinedundefinedcall_user_func_array([Sabre\DAV\CorePlugin {},"httpPut"], [Sabre\HTTP\Requ ... }])
 6. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    Sabre\Event\EventEmitter->emit("method:PUT", [Sabre\HTTP\Requ ... }])
 7. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
 8. /var/www/nextcloud/apps/dav/lib/Server.php line 316
    Sabre\DAV\Server->exec()
 9. /var/www/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
10. /var/www/nextcloud/remote.php line 163
    undefinedundefinedrequire_once("/var/www/nextcl ... p")

PUT /remote.php/dav/uploads/redscape@glarose.fr/3170073653/00000001
from 2.10.73.192 by redscape@glarose.fr at 2019-08-14T22:57:02+00:00

This is a fairly common mistake, which have been the subject of tickets on Github, but as the problem seems random, it is difficult to fill.

I am sorry to open a new topic while another has been opened.
The solution has apparently been found for Apache, but nothing is indicated with nginx.

Details
Nextcloud version : 16.0.3
Operating system and version : 18.04
nginx version : 1.14
PHP version : 7.2
Nextcloud client upload : 2.5.2 (20190319) / Windows 10

My PHP config file :

<?php
$CONFIG = array (
  'passwordsalt' => 'VuKTRxJ0l7dcbKDiKqNht9u7z8TGqe',
  'secret' => 'SRfudJ3OuoYw8Cv/9hQGfPKl49iezZ+bM5Vi3Tkluo3f7y5W',
  'trusted_domains' =>
  array (
    0 => 'XXXXXXX',
  ),
  'datadirectory' => '/home/nextcloud/nc_data',
  'dbtype' => 'mysql',
  'version' => '16.0.3.0',
  'overwrite.cli.url' => 'XXXXX',
  'dbname' => 'XXXXX',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'red_next',
  'dbpassword' => 'XXXXXXX',
  'installed' => true,
  'instanceid' => 'ocf0q4gs5bo4',
  'mail_from_address' => 'XXXXX',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'XXXXX',
  'mail_smtphost' => 'XXXXX',
  'mail_smtpport' => '587',
  'mail_smtpsecure' => 'tls',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'redscape@glarose.fr',
  'mail_smtppassword' => 'LmpzI!890517_rrrk',
  'memcache.local' => '\OC\Memcache\APCu',
  'memcache.locking' => '\OC\Memcache\Redis',
  'redis' => array(
    'host' => 'localhost',
    'port' => 6379,
  ),
);

I really like Nextcloud, and I need it on a daily basis, it would bother me to come back to proprietary cloud, whereas overall, NC is exactly what I need.

2 Likes

And this is the message after the loop synchronization schema :

image

Try this at your desktop computer:

  • stop your sync client
  • remove hidden files called ._sync_* inside of your sync directory
  • start your sync client again

Hi,

I’m sorry I have no idea how to fix this on nginx. Seems my fix only works when an apache module is commented out.

Sorry for my response time.

For the moment it hasn’t happened again, I haven’t been working on my files as much as usual.
But I note the solution that could be very useful to me.

I see a lot of the same error:
Fatal error: webdav Sabre\DAV\Exception\ServiceUnavailable: Could not open file
The nextcloud version 20.0.8, also on nginx and php-fpm.