Expected more bytes than received. Unable to transfer most files ~ 200MB and over

Nextcloud version: 28.0.2
Operating system and version: Linux 6.6.12-linuxkit x86_64
Apache version: 2.4.57
PHP version: 8.2.16

Hi, I have recently setup a nextcloud on a 2012 Mac Mini in docker with an Intel I7 3615QM CPU and 12GB of allocated ram. I have put docker desktop on top of opencore macOS Sonoma, which is what nextcloud is installed on. When I try to upload files around ~ 200mb and over, I quickly get a connection error. I believe I have correctly set it not to do this in .htaccess shown below,

php_value upload_max_filesize 64G
php_value post_max_size 64G
php_value max_input_time 7200
php_value max_execution_time 7200
php_value memory_limit 12288M
php_value max_chunk_size 64G

but maybe I needed to do something else. Any help is appreciated. Thanks!

Is this the first time you’ve seen this error?: N

Steps to replicate it:

  1. Try to upload a larger file through the client or web browser.

The output of your Nextcloud log in Admin > Logging:

[no app in context] Error: Expected filesize of 86993782 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 5513216 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/dav/uploads/Kthor426/1100573277/00002
	from XXX.XX.XXX.XX by Kthor426 at Mar 30, 2024, 1:46:44 PM

The output of your config.php file in /path/to/nextcloud

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'XXX.XXX.X.X',
    'port' => '6379',),
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'upgrade.disable-web' => true,
  'instanceid' => 'XXXXXXXXXXXX',
  'passwordsalt' => 'XXXXXXXXXXXXXX',
  'secret' => 'XXXXXXXXXXXXXXXXXXXXX',
  'trusted_domains' =>
  array (
    0 => 'localhost:8080',
    1 => 'XXXXXX.com',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '28.0.2.5',
  'overwrite.cli.url' => 'http://localhost:8080',
  'installed' => true,
  'overwriteprotocol' => 'https',
  'default_phone_region' => 'US',
  'enable_previews' => true,
   'enabledPreviewProviders' =>
   array (
     0 => 'OC\\Preview\\PNG',
     1 => 'OC\\Preview\\JPEG',
     2 => 'OC\\Preview\\GIF',
     3 => 'OC\\Preview\\HEIC',
     4 => 'OC\\Preview\\BMP',
     5 => 'OC\\Preview\\XBitmap',
     6 => 'OC\\Preview\\MP3',
     7 => 'OC\\Preview\\TXT',
     8 => 'OC\\Preview\\Markdown',
     9 => 'OC\\Preview\\PDF',
     10 => 'OC\\Preview\\Movie',
     11 => 'OC\\Preview\\MP4'
   ),
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' =>
  array (
    0 => 'admin',
  ),
  'twofactor_enforced_excluded_groups' =>
  array (
  ),
  'loglevel' => 2,
  'maintenance' => false,
  'maintenance_window_start' => 6,
  'dbname' => 'nextcloud',
  'dbhost' => 'XXX.XX.XXX.XX',
  'dbuser' => 'nextcloud',
  'dbpassword' => 'PASSWORD',
  'filelocking.enabled' => true,
  'auth.bruteforce.protection.enabled' => true,
  'auth.bruteforce.whitelist' =>
  array (
    0 => 'XXX.XXX.XX.X',
    1 => 'XXX.XX.XXX.XX',
 ),
  'trusted_proxies' =>
  array (
    0 => 'XXX.XXX.XX.X',
  ),
  'mail_smtpmode' => 'sendmail',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'Alert',
  'mail_domain' => 'XXXXXX.com',
);

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

{"reqId":"Q9Hype2awiEKGlISmMGt","level":3,"time":"2024-03-30T23:28:09+00:00","remoteAddr":"XXX.XX.XXX.XX","user":"Kthor426","app":"no app in context","method":"PUT","url":"/remote.php/dav/uploads/Kthor426/2701990113/00001","message":"Expected filesize of 10000000 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 5873664 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.","userAgent":"Mozilla/5.0 (Windows) mirall/3.12.2stable-Win64 (build 20240320) (Nextcloud, windows-10.0.22631 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"28.0.2.5","exception":{"Exception":"Sabre\\DAV\\Exception\\BadRequest","Message":"Expected filesize of 10000000 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 5873664 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.","Code":0,"Trace":[{"file":"/var/www/html/apps/dav/lib/Connector/Sabre/Directory.php","line":148,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/apps/dav/lib/Upload/UploadFolder.php","line":51,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":1098,"function":"createFile","class":"OCA\\DAV\\Upload\\UploadFolder","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":504,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[["Sabre\\HTTP\\Request"],["Sabre\\HTTP\\Response"]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["method:PUT",[["Sabre\\HTTP\\Request"],["Sabre\\HTTP\\Response"]]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[["Sabre\\HTTP\\Request"],["Sabre\\HTTP\\Response"]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/lib/Server.php","line":370,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/remote.php","line":172,"args":["/var/www/html/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/apps/dav/lib/Connector/Sabre/File.php","Line":301,"message":"Expected filesize of 10000000 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 5873664 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.","exception":[],"CustomMessage":"Expected filesize of 10000000 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 5873664 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side."},"id":"6608f5c498dde"}
[no app in context] Error: Could not decrypt or decode encrypted session data
	REPORT /remote.php/dav/files/Kthor426
	from XXX.XX.XXX.XX by -- at Mar 30, 2024, 2:11:45 PM

Here are a few parameters to check:
https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/big_file_upload_configuration.html

If you use a reverse proxy, this can also terminate the connection (timeout etc.)