Sabre\DAV\Exception\BadRequest expected XXXXXXX got 0

cannot upload files

Sorry to hear you’re facing problems :slightly_frowning_face:

Or for longer, use three backticks above and below the code snippet:

[no app in context] Error: Sabre\DAV\Exception\BadRequest: expected filesize 1849608 got 0 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/3rdparty/sabre/dav/lib/DAV/Server.php line 1096
   OCA\DAV\Connector\Sabre\Directory->createFile("IMG_3297 (1).JPG", null)
2. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 525
   Sabre\DAV\Server->createFile("Photos/IMG_3297 (1).JPG", null, null)
3. <<closure>>
   Sabre\DAV\CorePlugin->httpPut(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
4. /var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
   undefinedundefinedcall_user_func_array([Sabre\DAV\CorePlugin {},"httpPut"], [Sabre\HTTP\Requ ... }])
5. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479
   Sabre\Event\EventEmitter->emit("method:PUT", [Sabre\HTTP\Requ ... }])
6. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254
   Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
7. /var/www/nextcloud/apps/dav/appinfo/v1/webdav.php line 80
   Sabre\DAV\Server->exec()
8. /var/www/nextcloud/remote.php line 163
   undefinedundefinedrequire_once("/var/www/nextcl ... p")

PUT /remote.php/webdav/Photos/IMG_3297%20(1).JPG
from 192.168.1.2 by della-schiava at 2019-07-13T08:29:21+00:00

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version: 16.0.3
Operating system and version (eg, Ubuntu 17.04): Debian 9.8
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.25 (Debian)
PHP version (eg, 7.1): 7.3.4

The issue you are facing:
Eventually, photos stop uploading to the server. I get anywhere from 2-10GB of the total 30GB+ of image data, then I just errors like the one shown before in my log, and nothing more is transferred to the cloud.

Is this the first time you’ve seen this error? (Y/N): Pretty much ongoing, with this particular use case (transfer over 10k+ pictures)

Steps to replicate it:

Note: This occurs from the mobile client AND from the Browser (have not tried the desktop syncing client, yet)

  1. Select files to upload, per normal
    Observe: files upload as expected. I even insure to make sure the computer does not sleep
  2. Eventually, the files stop uploading.

I have tried many times, creating new users (both OS AND NC users), and starting again, ultimately, error occurs again.

The output of your Nextcloud log in Admin > Logging:
There are endless stream of the message above.


The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

[no app in context] Error: Sabre\DAV\Exception\BadRequest: expected filesize 1849608 got 0 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/3rdparty/sabre/dav/lib/DAV/Server.php line 1096
   OCA\DAV\Connector\Sabre\Directory->createFile("IMG_3297 (1).JPG", null)
2. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 525
   Sabre\DAV\Server->createFile("Photos/IMG_3297 (1).JPG", null, null)
3. <<closure>>
   Sabre\DAV\CorePlugin->httpPut(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
4. /var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
   undefinedundefinedcall_user_func_array([Sabre\DAV\CorePlugin {},"httpPut"], [Sabre\HTTP\Requ ... }])
5. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479
   Sabre\Event\EventEmitter->emit("method:PUT", [Sabre\HTTP\Requ ... }])
6. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254
   Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
7. /var/www/nextcloud/apps/dav/appinfo/v1/webdav.php line 80
   Sabre\DAV\Server->exec()
8. /var/www/nextcloud/remote.php line 163
   undefinedundefinedrequire_once("/var/www/nextcl ... p")

PUT /remote.php/webdav/Photos/IMG_3297%20(1).JPG
from 192.168.1.2 by example-user at 2019-07-13T08:29:21+00:00

The output of your Apache/nginx/system log in /var/log/____:


EDIT: I just realized, it’s complicated. Will try to get as far as I can.

This matter was already discussed numerous times.

At least for Apache you’ll find the solution here:

and here:

Thanks for the reply.

What also worked, alternatively, was installing the nextcloud desktop client. I was able to transfer over everything.

I will also amend my configuration files per the above suggestions.