Sabre\DAV\Exception\BadRequest: Expected filesize of 3066419 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 40960 bytes

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

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

longer
example
here

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:

NextCloudPi 17.0.2

The issue you are facing:
I am getting this error since a few days when trying to sync files from my Windows 7 PC. The Client is updated to the latest version 2.6.2.

any help to solve this would be highly appreciated.

I am a Newbie and I followed step by step instructions and used a nextcloudpi image. I can connect via Telnet but would need very detailed advice what to do.

Thanx alot.

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

Steps to replicate it:

  1. not sure :frowning:

The output of your Nextcloud log in Admin > Logging:

Fatal	webdav	Sabre\DAV\Exception\BadRequest: Expected filesize of 3066419 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 40960 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.

    /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php - line 156:

    OCA\DAV\Connector\Sabre\File->put(null)

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1096:

    OCA\DAV\Connector\Sabre\Directory->createFile(".IMG_0870.MP4.~41c9", null)

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 525:

    Sabre\DAV\Server->createFile("files/cherb ... 9", null, null)

    <<closure>>

    Sabre\DAV\CorePlugin->httpPut(Sabre\HTTP\R ... "}, Sabre\HTTP\Response {})

    /var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105:

    call_user_func_array([ Sabre\DAV\ ... "], [ Sabre\HTTP ... }])

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479:

    Sabre\Event\EventEmitter->emit("method:PUT", [ Sabre\HTTP ... }])

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254:

    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\R ... "}, Sabre\HTTP\Response {})

    /var/www/nextcloud/apps/dav/lib/Server.php - line 317:

    Sabre\DAV\Server->exec()

    /var/www/nextcloud/apps/dav/appinfo/v2/remote.php - line 35:

    OCA\DAV\Server->exec()

    /var/www/nextcloud/remote.php - line 163:

    require_once("/var/www/ne ... p")

	
2019-12-28T23:03:53+0100
Error	no app in context	Sabre\DAV\Exception\BadRequest: Expected filesize of 3066419 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 40960 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.	
2019-12-28T23:03:53+0100
Fatal	webdav	Sabre\DAV\Exception\BadRequest: Expected filesize of 1425264 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 385024 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.	
2019-12-28T22:58:12+0100
Error	no app in context	Sabre\DAV\Exception\BadRequest: Expected filesize of 1425264 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 385024 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.	
2019-12-28T22:58:12+0100
Fatal	webdav	Sabre\DAV\Exception\BadRequest: Expected filesize of 1425264 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 532480 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.	
2019-12-28T22:52:25+0100
Error	no app in context	Sabre\DAV\Exception\BadRequest: Expected filesize of 1425264 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 532480 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.	
2019-12-28T22:52:25+0100
Fatal	webdav	Sabre\DAV\Exception\BadRequest: Expected filesize of 646791 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 434176 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.	
2019-12-28T22:46:44+0100
Error	no app in context	Sabre\DAV\Exception\BadRequest: Expected filesize of 646791 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 434176 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.	
2019-12-28T22:46:44+0100
Fatal	webdav	Sabre\DAV\Exception\BadRequest: Expected filesize of 646791 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 40960 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.	
2019-12-28T22:40:58+0100
Error	no app in context	Sabre\DAV\Exception\BadRequest: Expected filesize of 646791 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 40960 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.	
2019-12-28T22:40:58+0100
Fatal	webdav	Sabre\DAV\Exception\BadRequest: Expected filesize of 646791 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 352256 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.	
2019-12-28T22:35:13+0100
Error	no app in context	Sabre\DAV\Exception\BadRequest: Expected filesize of 646791 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 352256 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.	
2019-12-28T22:35:13+0100
Fatal	webdav	Sabre\DAV\Exception\BadRequest: Expected filesize of 646791 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 352256 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.	
2019-12-28T22:29:27+0100
Error	no app in context	Sabre\DAV\Exception\BadRequest: Expected filesize of 646791 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 352256 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.	
2019-12-28T22:29:27+0100

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

I am sorry I do not know how to get this information. I am pasting the system report that I can generate from the admin / upport panel:

Server configuration detail

Operating system: Linux 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l

Webserver: Apache (fpm-fcgi)

Database: mysql 10.1.37

PHP version: 7.2.26-1+0~20191218.33+debian9~1.gbpb5a34b

Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, sodium, session, standard, cgi-fcgi, mysqlnd, PDO, xml, bz2, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, gmp, iconv, igbinary, imagick, intl, json, ldap, exif, mysqli, pdo_mysql, Phar, posix, readline, redis, shmop, SimpleXML, smbclient, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlwriter, xsl, zip, libsmbclient, Zend OPcache

Nextcloud version: 17.0.2 - 17.0.2.1

Updated from an older Nextcloud/ownCloud or fresh install:

Where did you install Nextcloud from: unknown

<details><summary>Signing status</summary>

Array ( )

</details>

<details><summary>List of activated apps</summary>

Enabled:
 - accessibility: 1.3.0
 - activity: 2.10.1
 - cloud_federation_api: 1.0.0
 - comments: 1.7.0
 - contacts: 3.1.6
 - dav: 1.13.0
 - federatedfilesharing: 1.7.0
 - federation: 1.7.0
 - files: 1.12.0
 - files_pdfviewer: 1.6.0
 - files_rightclick: 0.15.1
 - files_sharing: 1.9.0
 - files_trashbin: 1.7.0
 - files_versions: 1.10.0
 - files_videoplayer: 1.6.0
 - firstrunwizard: 2.6.0
 - gallery: 18.4.0
 - logreader: 2.2.0
 - lookup_server_connector: 1.5.0
 - news: 14.1.0
 - nextcloud_announcements: 1.6.0
 - nextcloudpi: 0.0.1
 - notes: 3.1.0
 - notifications: 2.5.0
 - oauth2: 1.5.0
 - password_policy: 1.7.0
 - previewgenerator: 2.2.0
 - privacy: 1.1.0
 - provisioning_api: 1.7.0
 - recommendations: 0.5.0
 - serverinfo: 1.7.0
 - sharebymail: 1.7.0
 - support: 1.0.1
 - survey_client: 1.5.0
 - systemtags: 1.7.0
 - tasks: 0.11.3
 - text: 1.1.1
 - theming: 1.8.0
 - twofactor_backupcodes: 1.6.0
 - updatenotification: 1.7.0
 - viewer: 1.2.0
 - workflowengine: 1.7.0
Disabled:
 - admin_audit
 - calendar
 - encryption
 - files_external
 - files_texteditor
 - previewgenerator.orig
 - user_ldap



</details>

<details><summary>Configuration (config/config.php)</summary>

{
    "passwordsalt": "***REMOVED SENSITIVE VALUE***",
    "secret": "***REMOVED SENSITIVE VALUE***",
    "trusted_domains": {
        "0": "localhost",
        "5": "nextcloudpi.local",
        "7": "nextcloudpi",
        "8": "nextcloudpi.lan",
        "11": "92.200.93.6",
        "1": "192.168.178.53",
        "4": "cherberg.de"
    },
    "datadirectory": "***REMOVED SENSITIVE VALUE***",
    "dbtype": "mysql",
    "version": "17.0.2.1",
    "overwrite.cli.url": "https:\/\/cherberg.de\/",
    "dbname": "***REMOVED SENSITIVE VALUE***",
    "dbhost": "***REMOVED SENSITIVE VALUE***",
    "dbport": "",
    "dbtableprefix": "oc_",
    "mysql.utf8mb4": true,
    "dbuser": "***REMOVED SENSITIVE VALUE***",
    "dbpassword": "***REMOVED SENSITIVE VALUE***",
    "installed": true,
    "instanceid": "***REMOVED SENSITIVE VALUE***",
    "memcache.local": "\\OC\\Memcache\\Redis",
    "memcache.locking": "\\OC\\Memcache\\Redis",
    "redis": {
        "host": "***REMOVED SENSITIVE VALUE***",
        "port": 0,
        "timeout": 0,
        "password": "***REMOVED SENSITIVE VALUE***"
    },
    "tempdirectory": "\/media\/USBdrive\/ncdata\/tmp",
    "mail_smtpmode": "sendmail",
    "mail_smtpauthtype": "LOGIN",
    "mail_from_address": "***REMOVED SENSITIVE VALUE***",
    "mail_domain": "***REMOVED SENSITIVE VALUE***",
    "overwriteprotocol": "https",
    "maintenance": false,
    "logfile": "\/media\/USBdrive\/ncdata\/nextcloud.log",
    "loglevel": "2",
    "log_type": "file",
    "jpeg_quality": "60",
    "theme": ""
}


</details>

External storages: files_external is disabled

Encryption: no

User-backends:

OC\User\Database

Browser: Mozilla/5.0 (Windows NT 6.1; rv:71.0) Gecko/20100101 Firefox/71.0

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

PASTE HERE

Might be related to "HEADERS on invalid stream"

Did anyone ever figure out what was the exact cause of this issue? Still persists for some users especially when trying to upload larger MOV files…

Yes, here… :slight_smile:

Sabre\DAV\Exception\BadRequest: Expected filesize of 10240000 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 2887680 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.

/mnt/md0/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php - line 156:

OCA\DAV\Connector\Sabre\File->put(null)

/mnt/md0/nextcloud/apps/dav/lib/Upload/UploadFolder.php - line 47:

OCA\DAV\Connector\Sabre\Directory->createFile("00000000000 ... 9", null)

/mnt/md0/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1096:

OCA\DAV\Upload\UploadFolder->createFile("00000000000 ... 9", null)

/mnt/md0/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 525:

Sabre\DAV\Server->createFile("uploads/3wS ... 9", null, null)

<<closure>>

Sabre\DAV\CorePlugin->httpPut(Sabre\HTTP\R ... "}, Sabre\HTTP\Response {})

/mnt/md0/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105:

call_user_func_array([ Sabre\DAV\ ... "], [ Sabre\HTTP ... }])

/mnt/md0/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479:

Sabre\Event\EventEmitter->emit("method:PUT", [ Sabre\HTTP ... }])

/mnt/md0/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254:

Sabre\DAV\Server->invokeMethod(Sabre\HTTP\R ... "}, Sabre\HTTP\Response {})

/mnt/md0/nextcloud/apps/dav/lib/Server.php - line 319:

Sabre\DAV\Server->exec()

/mnt/md0/nextcloud/apps/dav/appinfo/v2/remote.php - line 35:

OCA\DAV\Server->exec()

/mnt/md0/nextcloud/remote.php - line 165:

require_once("/mnt/md0/ne ... p")

@matzo_fatzoyes here what? What did you mean by that? that you found out a solution or that it is still happening to you?