Sabre\DAV\Exception\BadRequest: expected filesize X got Y (random behaviour)

Yeah, I know … this pops up every so often.

However, the threads I found regarding this topic all had one thing in common: A certain filesize that - when exceeded - produced the error above.

In my case, however, the behaviour apparently has NOTHING to do with filesize at all:
The files in question are between 7 and 15 MB.
I uploaded flawlessly files sized over 100 MB before … so size cannot be an issue in my eyes.
(Then again, the nextcloud is female, isn’t it?)

So, I’d say as a first step I need to qualify the issue further.
This raises the question: where do I look / which information is needed?

Many thanks and kind regards,
Kai

Nextcloud version (eg, 12.0.2): 15.0.5
Operating system and version (eg, Ubuntu 17.04): (hosted by Strato)
Apache or nginx version (eg, Apache 2.4.25): (hosted by Strato … so, the latest, I suppose)
PHP version (eg, 7.1): 7.2

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

Steps to replicate it:

Leave the files where they are on the client - the error will come again.

To make things worse: For some files a workaround is this:

  • Remove the file from the nextcloud directory on the client
  • Empty the oc_file_lock table
  • Move the file back to its position within the nextcloud directory on the client
    -> Success!
    The success here, however, is again entirely random. For some files the process works, for others it does not.

The output of your Nextcloud log in Admin > Logging:

Fatal	webdav	Sabre\DAV\Exception\BadRequest: expected filesize 7239121 got 5267456
/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php - line 156:

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

/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1096:

OCA\DAV\Connector\Sabre\Directory->createFile("Instructions_PFB_Sloop.pdf", null)

/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 525:

Sabre\DAV\Server->createFile("files/schat ... f", null, null)

<<closure>>

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

/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105:

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

/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479:

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

/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254:

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

/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/apps/dav/lib/Server.php - line 301:

Sabre\DAV\Server->exec()

/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/apps/dav/appinfo/v2/remote.php - line 35:

OCA\DAV\Server->exec()

/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/remote.php - line 163:

require_once("/mnt/web021 ... p")


Error	no app in context	Sabre\DAV\Exception\BadRequest: expected filesize 7239121 got 5267456
/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php - line 156:

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

/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1096:

OCA\DAV\Connector\Sabre\Directory->createFile("Instructions_PFB_Sloop.pdf", null)

/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 525:

Sabre\DAV\Server->createFile("files/schat ... f", null, null)

<<closure>>

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

/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105:

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

/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479:

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

/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254:

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

/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/apps/dav/lib/Server.php - line 301:

Sabre\DAV\Server->exec()

/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/apps/dav/appinfo/v2/remote.php - line 35:

OCA\DAV\Server->exec()

/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/remote.php - line 163:

require_once("/mnt/web021 ... p")

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

<?php
$CONFIG = array (
  'instanceid' => '<REMOVED>',
  'passwordsalt' => '<REMOVED>',
  'secret' => '<REMOVED>',
  'trusted_domains' => 
  array (
    0 => 'cloud.catzeyes.de',
  ),
  'datadirectory' => '/mnt/web021/e3/85/51320785/htdocs/catzeyes/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '15.0.5.3',
  'overwrite.cli.url' => 'http://cloud.catzeyes.de',
  'dbname' => '<NAME>',
  'dbhost' => 'rdbms.strato.de',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '<USER>',
  'dbpassword' => '<PASSWORD>',
  'installed' => true,
  'tempdirectory' => '/mnt/web021/e3/85/51320785/htdocs/catzeyes/tmp',
  'updater.secret' => '<REMOVED>',
);

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

(not available / no acccess)

Please refer to my practice

Thanks for the reply,

Alas, as I’m dependan on a hosted website, I do not have access to the httpd.conf …

Kind regards,
Kai