Sabre\DAV\Exception\BadRequest: expected filesize 10485760 got 2554891

Nextcloud version (eg, 12.0.2): 15.0.7
Operating system and version (eg, Ubuntu 17.04): FreeBSD 12-stable
Apache or nginx version (eg, Apache 2.4.25): apache 2.4.39
PHP version (eg, 7.1): php72-7.2.17

The issue you are facing:
Broken uploads for any file from anywhere uploaded by any method if the file is larger than 2.4MB in size. Smaller files upload fine. It starts the upload, stops, attempts to restart and then fails.

The example listed below is uploading the nextcloud manual which is 6.3MB in size. The error is classified as a fatal error from webdav

Is this the first time you’ve seen this error? (Y/N): N

Steps to replicate it:

  1. upload a file larger than 2.4MB

The output of your Nextcloud log in Admin > Logging:

{"reqId":"wJreN3OwY0sygrA9mlt3","level":4,"time":"2019-04-10T13:19:24+00:00","remoteAddr":"[REDACTED-IP-ADDRESS]","user":"[REDACTED]","app":"webdav","method":"PUT","url":"/remote.php/webdav/Nextcloud%20Manual.pdf","message":{"Exception":"Sabre\\DAV\\Exception\\BadRequest","Message":"expected filesize 6628477 got 2456627","Code":0,"Trace":[{"file":"/usr/local/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":156,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->","args":[null]},{"file":"/usr/local/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1096,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["Nextcloud Manual.pdf",null]},{"file":"/usr/local/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":525,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->","args":["Nextcloud Manual.pdf",null,null]},{"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"https://[REDACTED-SERVER-NAME]/remote.php/webdav/Nextcloud%20Manual.pdf","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/usr/local/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpPut"],[{"absoluteUrl":"https://[REDACTED-SERVER-NAME]/remote.php/webdav/Nextcloud%20Manual.pdf","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/usr/local/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:PUT",[{"absoluteUrl":"https://[REDACTED-SERVER-NAME]/remote.php/webdav/Nextcloud%20Manual.pdf","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/usr/local/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"https://[REDACTED-SERVER-NAME]/remote.php/webdav/Nextcloud%20Manual.pdf","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/usr/local/www/nextcloud/apps/dav/appinfo/v1/webdav.php","line":80,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/usr/local/www/nextcloud/remote.php","line":163,"args":["/usr/local/www/nextcloud/apps/dav/appinfo/v1/webdav.php"],"function":"require_once"}],"File":"/usr/local/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php","Line":222,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0","version":"","id":"5caded7c5881c"}

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

not sure what you're asking here. There is no 'config.php' in the nextcloud directory. There are various subdirectories some of which have a config.php.

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

in the logs at the time there's this:

[REDACTED] - [REDACTED_LOGIN] [10/Apr/2019:14:19:02 +0100] "PROPFIND /remote.php/dav/files/[REDACTED_LOGIN]/ HTTP/1.1" 207 391
[REDACTED] - [REDACTED_LOGIN] [10/Apr/2019:14:19:16 +0100] "PROPFIND /remote.php/dav/files/[REDACTED_LOGIN]/ HTTP/1.1" 207 371
[REDACTED] - - [10/Apr/2019:14:19:17 +0100] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 74
[REDACTED] - - [10/Apr/2019:14:19:18 +0100] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 74
[REDACTED] - - [10/Apr/2019:14:19:04 +0100] "PUT /remote.php/webdav/Nextcloud%20Manual.pdf HTTP/1.1" 400 231
[REDACTED] - - [10/Apr/2019:14:19:27 +0100] "GET /index.php/apps/files/ajax/getstoragestats.php?dir=%2F HTTP/1.1" 200 228
[REDACTED] - [REDACTED_LOGIN] [10/Apr/2019:14:19:34 +0100] "PROPFIND /remote.php/dav/files/[REDACTED_LOGIN]/ HTTP/1.1" 207 391
[REDACTED] - - [10/Apr/2019:14:19:34 +0100] "GET /index.php/settings/user HTTP/1.1" 200 100766
[REDACTED] - - [10/Apr/2019:14:19:40 +0100] "GET /index.php/avatar/[REDACTED_LOGIN]/32?v=0 HTTP/1.1" 304 -
[REDACTED] - - [10/Apr/2019:14:19:40 +0100] "GET /index.php/svg/spreed/app-dark?color=000&v=1 HTTP/1.1" 500 8485
[REDACTED] - - [10/Apr/2019:14:19:42 +0100] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 74
[REDACTED] - - [10/Apr/2019:14:19:42 +0100] "GET /index.php/apps/apporder/getOrder HTTP/1.1" 200 43
[REDACTED] - - [10/Apr/2019:14:19:42 +0100] "PROPFIND /remote.php/webdav HTTP/1.1" 207 2251
[REDACTED] - - [10/Apr/2019:14:19:42 +0100] "GET /index.php/heartbeat HTTP/1.1" 200 -
[REDACTED] - - [10/Apr/2019:14:19:42 +0100] "GET /data/.ocdata?t=1554902382100 HTTP/1.1" 302 -
[REDACTED] - - [10/Apr/2019:14:19:42 +0100] "GET /index.php/avatar/[REDACTED_LOGIN]/145?v=0 HTTP/1.1" 304 -
[REDACTED] - - [10/Apr/2019:14:19:43 +0100] "GET /index.php/apps/files/ HTTP/1.1" 200 73495
[REDACTED] - - [10/Apr/2019:14:19:42 +0100] "GET /index.php/settings/ajax/checksetup HTTP/1.1" 200 1683
[REDACTED] - [REDACTED_LOGIN] [10/Apr/2019:14:19:44 +0100] "PROPFIND /remote.php/dav/files/[REDACTED_LOGIN]/ HTTP/1.1" 207 371
[REDACTED] - - [10/Apr/2019:14:19:46 +0100] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 74
[REDACTED] - - [10/Apr/2019:14:19:48 +0100] "GET /index.php/settings/admin/logging HTTP/1.1" 200 52012
[REDACTED] - - [10/Apr/2019:14:19:53 +0100] "GET /index.php/svg/spreed/app-dark?color=000&v=1 HTTP/1.1" 500 8485
[REDACTED] - - [10/Apr/2019:14:19:54 +0100] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 74
[REDACTED] - - [10/Apr/2019:14:19:54 +0100] "GET /index.php/avatar/[REDACTED_LOGIN]/32?v=0 HTTP/1.1" 304 -

Hi. I have exact same problem and perhaps exact same system, FreeBSD12, Apache, PHP 7.2 (see below). I think they are looking to see your nextcloud/config/config.php file (you should sanitize it of course).

I see the file being written to the respective folder inside ‘uploads’, it must happen during the re-assembly process of the chunks.

I updated to 15.0.7 yesterday and I think it was working OK before that. FIX FIX FIX please!

PHP 7.2.17 (cli) (built: Apr  6 2019 01:13:10) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.17, Copyright (c) 1999-2018, by Zend Technologies

Not sure how to get my current apache version… it’s current package version though.

Maybe I spoke too soon… I just uploaded a 140MB zip file and it chunked into 10MB parts and then it wrote the file just fine. I am using Firefox on Linux as my browser. I piled on to your post because someone was trying to send me some files and this error was happening.

That person was using Chrome on a Mac.

Thanks for replying. I have to test from more other systems - so far gvfs (thunar/nemo on Mate desktop on freebsd) gives same error, so does android. Have not tried from linux mint. Think it’s a server-side problem though.

Have also tried via nextcloud deskapp on freebsd and the android app

On your freebsd machine you can get the current apache version by typing pkg info -x apache at the terminal

Just tested from chromium browser on a chromebook and firefox quantum 66.0.1 on linux mint 18 with same result


Thanks for that… I just successfully uploaded a file a little over 600 MB using Chrome on Linux. Not sure why my user was having problems but will keep investigating.

here are the errors from the nextcloud log when this happened, a pair of entries:

[no app in context] Error: Sabre\DAV\Exception\BadRequest: expected filesize 10485760 got 4603904 at <>

  1. /usr/local/www/apache24/data/ft/x/apps/dav/lib/Connector/Sabre/Directory.php line 156
  2. /usr/local/www/apache24/data/ft/x/apps/dav/lib/Upload/UploadFolder.php line 39
    createFile(“0”, null)
  3. /usr/local/www/apache24/data/ft/x/3rdparty/sabre/dav/lib/DAV/Server.php line 1096
    createFile(“0”, null)
  4. /usr/local/www/apache24/data/ft/x/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 525
    createFile(“uploads/jxxx … 0”, null, null)
  5. <>
    httpPut(Sabre\HTTP\Reque … "}, Sabre\HTTP\Response {})
  6. /usr/local/www/apache24/data/ft/x/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    call_user_func_array([Sabre\DAV\CorePlugin {},“httpPut”], [Sabre\HTTP\Requ … }])
  7. /usr/local/www/apache24/data/ft/x/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    emit(“method:PUT”, [Sabre\HTTP\Requ … }])
  8. /usr/local/www/apache24/data/ft/x/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    invokeMethod(Sabre\HTTP\Reque … "}, Sabre\HTTP\Response {})
  9. /usr/local/www/apache24/data/ft/x/apps/dav/lib/Server.php line 301
  10. /usr/local/www/apache24/data/ft/x/apps/dav/appinfo/v2/remote.php line 35
  11. /usr/local/www/apache24/data/ft/x/remote.php line 163
    require_once("/usr/local/www/ … p")

PUT /t5000/remote.php/dav/uploads/-redacted


[webdav] Fatal: Sabre\DAV\Exception\BadRequest: expected filesize 10485760 got 4603904 at <>

  1. /usr/local/www/apache24/data/ft/x/apps/dav/lib/Connector/Sabre/Directory.php line 156
  2. /usr/local/www/apache24/data/ft/x/apps/dav/lib/Upload/UploadFolder.php line 39
    createFile(“0”, null)
  3. /usr/local/www/apache24/data/ft/x/3rdparty/sabre/dav/lib/DAV/Server.php line 1096
    createFile(“0”, null)
  4. /usr/local/www/apache24/data/ft/x/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 525
    createFile(“uploads/jxxx … 0”, null, null)
  5. <>
    httpPut(Sabre\HTTP\Reque … "}, Sabre\HTTP\Response {})
  6. /usr/local/www/apache24/data/ft/x/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    call_user_func_array([Sabre\DAV\CorePlugin {},“httpPut”], [Sabre\HTTP\Requ … }])
  7. /usr/local/www/apache24/data/ft/x/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    emit(“method:PUT”, [Sabre\HTTP\Requ … }])
  8. /usr/local/www/apache24/data/ft/x/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    invokeMethod(Sabre\HTTP\Reque … "}, Sabre\HTTP\Response {})
  9. /usr/local/www/apache24/data/ft/x/apps/dav/lib/Server.php line 301
  10. /usr/local/www/apache24/data/ft/x/apps/dav/appinfo/v2/remote.php line 35
  11. /usr/local/www/apache24/data/ft/x/remote.php line 163
    require_once("/usr/local/www/ … p")

PUT /t5000/remote.php/dav/uploads/-redacted

Staff edit: please be constructive or refrain yourself from posting.


Sabre is dead meat now…
It was fucking idiotic decision to make to tighten so tighly with something this dead…
that does not change the fact that NC’s devs have an obligation to rremove every usage of Sabre-* package(s) from NC as soon as people started to become vocal…

Not to mention Im being spammed by meaningless logentries all the time.

Ok -


$CONFIG = array (
‘apps_paths’ =>
array (
0 =>
array (
‘path’ => ‘/usr/local/www/nextcloud/apps’,
‘url’ => ‘/apps’,
‘writable’ => true,
1 =>
array (
‘path’ => ‘/usr/local/www/nextcloud/apps-pkg’,
‘url’ => ‘/apps-pkg’,
‘writable’ => false,
‘logfile’ => ‘/var/log/nextcloud/nextcloud.log’,
‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘instanceid’ => ‘ocixq9iqzsm5’,
‘passwordsalt’ => ‘REDACTED’,
‘secret’ => ‘REDACTED’,
‘trusted_domains’ =>
array (
0 => ‘’,
‘datadirectory’ => ‘/usr/local/www/nextcloud/data’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘’,
‘overwrite.cli.url’ => ‘’,
‘dbname’ => ‘nextcloud’,
‘dbhost’ => ‘localhost’,
‘dbport’ => ‘’,
‘dbtableprefix’ => ‘oc_’,
‘dbuser’ => ‘oc_REDACTED’,
‘dbpassword’ => ‘REDACTED’,
‘installed’ => true,
‘mysql.utf8mb4’ => true,
‘maintenance’ => false,
‘theme’ => ‘’,
‘loglevel’ => 2,
‘mail_from_address’ => ‘www-cloud’,
‘mail_smtpmode’ => ‘smtp’,
‘mail_sendmailmode’ => ‘smtp’,
‘mail_domain’ => ‘REDACTED’,
‘mail_smtphost’ => ‘localhost’,
‘mail_smtpport’ => ‘25’,
‘’ => ‘production’,

php_value upload_max_filesize 16G
php_value post_max_size 16G
php_value memory_limit 512M
php_value mbstring.func_overload 0
php_value default_charset ‘UTF-8’
php_value output_buffering 0


Does owncloud suffer from the same problem? Or is it a sabre problem?

After doing some googling, it seems this same problem (though reported differently) happens in some installations but not others, regardless of how it’s hosted and on whatever OS, and regardless of version of NC, and there is no clear fix despite the issue being posted in one form or another for years. Worryingly, some folks have posted that their installation worked fine and then the problem started happening (and no clear indication of a resolution).

This particular installation is a brand new installation, installed at the end of March. I only discovered the problem after trying to upload a file over 2.4MB the first time. Interestingly, it does not have a problem installing various addons, or updating (the latter would be well over 2.4MB). On another virtual machine that is hosted on the same host, using the same OS, this problem does not happen.

Is there no fix for this? is the only resolution to delete the VM and start over? And hope that it doesn’t somehow just start happening again?

just tried with a fresh install, newly compiled apache24, php72 mysql certbot etc and same result. I’ll try spinning up an ubuntu vm next

edit; maybe it’s because a ssl cert was installed beforehand?

For the entries you provided, my .htaccess and .user.ini are similar. Config also.

You could try some testing without SSL to see if the problem happens. 2.4 MB is a surprisingly low threshold for the problem to occur, unless your upload speed it severely limited and it is a timeout issue of some sort.

You could also try testing it using a webdav client connection, instead of a web browser connection. Note the slightly different path for that. I believe that takes PHP out of the equation.

My guess is that Owncloud would not be a solution unless randomly so! Good luck, sorry I can’t be of more help.

I looked over my install notes … I found this one, can’t remember why, but you might try it:

Check config of pdo_mysql.ini at /usr/local/etc/php/ext-30-pdo_mysql.ini
had to increase php memory to 512.

Hi, thanks for replying

I have tried with webdav clients on linux, android and freebsd. I don’t think there’s any getting round php as (I think, might be wrong) dav in nextcloud is mediated by Sabre which is itself php. i’ll try disabling https later (this is problematic because HSTS is enabled)

I think you’re right in that owncloud wouldn’t be a solution as that also uses Sabre and from what I’ve read, it’s this part of it that appears to be the issue.

all that /usr/local/etc/php/ext-30-pdo_mysql.ini has in it is the following:

edit: might be specified in php.ini so will have a look there

yeah, sorry… that’s what’s in mine too. I’m not sure what I was referring to. Ignore!

ok, took off ssl, same result. Also loaded a minimalist httpd.conf, same result.
Next step is to grab latest nextcloud from themselves, move the old nextcloud dir over and start again. i’ll prob need to create a new db as well

I also spun up an ubuntu 18.10 vm and ran the snap install and this did not have this problem. 18.04 has its own issues installing as a vm (python/curtin errors) so that wasn’t tested as I have no bare hardware available right now.