Badrequest Issue, files fail to upload sometimes

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via 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:


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


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 (eg, 20.0.5): 23.0.2
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04.4
Apache or nginx version (eg, Apache 2.4.25): nginx 1.18.0
PHP version (eg, 7.4): 7.4.3

The issue you are facing:

Sometimes when I upload a lot of files some files error out, giving me an error that says “Expected filesize of 165079 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 163840 bytes” and then the file doesnt upload

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


Steps to replicate it:

  1. Upload a large amount of files (seems random when it happens)

The output of your Nextcloud log in Admin > Logging:

[no app in context] Error: Expected filesize of 165079 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 163840 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.

PUT /remote.php/webdav/<Folder 1>/<Sub Folder 1>/<Sub Folder 2>/<Image-XX>.jpg
from <My IP Adress> by DarkSide1305 at 2022-02-22T17:25:40+00:00

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

$CONFIG = array (
  'instanceid' => '<InstanceID>',
  'passwordsalt' => '<PasswordSalt>',
  'secret' => '<Secret>',
  'trusted_domains' =>
  array (
    0 => '<My Domain>',
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => '<My HTTPS Url>',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '<My DB Password>',
  'installed' => true,

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


I looked into my error and access log and it doesnt seem like there is too much more useful information in there, if more information is needed I can provide it.

Ive already googled this issue, but it doesnt seem like I can find any useful information anywhere.

Anyone have an Idea on how to fix this? Ive been searching for like, 2 days now and it seems A LOT of people have this issue, but every issue just kinda trails off into never being resolved.

I was able to extract a Log of Nextcloud. Nginx log has absolutely nothing in it, but here is my Nextcloud log of one instance of that error happening:

The issue is fixed - HTTP/2 is the problem. For some reason Nextcloud and Nginx cant handle HTTP/2. My Website is barely slower, uploads are up to 3x faster, and after 1k+ files they didnt bug out.