Nextcloud client not syncing all files: multiple errors when transferring: server replied: (empty) and other errors

Nextcloud version 16.0.3:
Operating system and version Raspbian Buster:
Apache version 2.4.38:
PHP version (eg, 7.3):
PostgreSQL version 11.4:

The issue you are facing: [EDIT: clarified]
Nextcloud client doesn’t sync all files. Some are up/downloaded, others aren’t (e.g. there are empty folders which shouldn’t be empty). I get errors, but after a while, Nextcloud tells me that everything’s synced (green sign in the client), but it’s not the case.

I get errors like 'ContentAccessDenied Error transferring [file] - server replied " ’ and ‘QVariant(int, 403)’

Unfortunately I don’t have a clue where to start. I thought my database system blacklisted me or locked some files, so I deleted all blacklisted addresses and locks from the database. The logs don’t get me anywhere. The errors in the apache log have occured for months, but nextcloud ran smoothly (I checked all config files for the ‘Require all granted’ line, and it’s there, in the newer 2.4 format).

I also tried the upload with a complete new folder, but some files fail (as mentioned above). I also ran
sudo -u www-data php occ files:scan --all
but the errors remain.

My Raspbian Buster is up-to-date and I already rebooted it.

I am sorry but I am pretty clueless as where to start or how to narrow down the problem. If you could point me into any direction I’d be really thankful.

Best regards
Richard

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

Steps to replicate it:

I really don’t know. Everything worked fined until yesterday, now I can’t upload or download without errors.

The output of your Nextcloud log in Admin > Logging:

Fatal	webdav	Sabre\DAV\Exception\BadRequest: expected filesize 75004430 got 66297856	
2019-08-01T11:49:24+0200
Error	no app in context	Sabre\DAV\Exception\BadRequest: expected filesize 75004430 got 66297856	
2019-08-01T11:49:24+0200
Error	core	Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'SELECT "uid", "displayname" FROM "oc_users" WHERE "uid_lower" = ?' with params ["benni"]: SQLSTATE[HY000]: General error: 7 no connection to the server	
2019-08-01T10:33:09+0200
Error	core	Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'SELECT "uid", "displayname" FROM "oc_users" WHERE "uid_lower" = ?' with params ["benni"]: SQLSTATE[57P01]: Admin shutdown: 7 FATAL: terminating connection due to administrator command server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request.	
2019-08-01T10:33:09+0200
Error	remote	Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'SELECT "uid", "displayname" FROM "oc_users" WHERE "uid_lower" = ?' with params ["benni"]: SQLSTATE[57P01]: Admin shutdown: 7 FATAL: terminating connection due to administrator command server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request.	
2019-08-01T10:33:09+0200
Error	core	Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'SELECT "uid", "displayname" FROM "oc_users" WHERE "uid_lower" = ?' with params ["benni"]: SQLSTATE[HY000]: General error: 7 no connection to the server	
2019-08-01T10:33:09+0200
Error	core	Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'SELECT "uid", "displayname" FROM "oc_users" WHERE "uid_lower" = ?' with params ["benni"]: SQLSTATE[57P01]: Admin shutdown: 7 FATAL: terminating connection due to administrator command server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request.	
2019-08-01T10:33:09+0200
Error	remote	Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'SELECT "uid", "displayname" FROM "oc_users" WHERE "uid_lower" = ?' with params ["benni"]: SQLSTATE[57P01]: Admin shutdown: 7 FATAL: terminating connection due to administrator command server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request.

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

<?php
$CONFIG = array (
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => 'x.com',
  ),
  'datadirectory' => '/mnt/raid1/nextcloud/data',
  'dbtype' => 'pgsql',
  'version' => '16.0.3.0',
  'overwrite.cli.url' => 'x.com',
  'dbname' => 'x',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'x',
  'dbpassword' => 'x',
  'installed' => true,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'mail_from_address' => 'x',
  'mail_smtpmode' => 'smtp',
  'mail_domain' => 'x.de',
  'mail_smtpport' => '587',
  'mail_smtphost' => 'smtp.x.de',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'x',
  'mail_smtppassword' => 'x',
  'memcache.local' => '\\OC\\Memcache\\APCu',

The output of your Apache error log in /var/log/____:

[Thu Aug 01 10:20:43.297641 2019] [evasive20:error] [pid 16226:tid 1690047520] [client 94.218.6.2:52554] client denied by server configuration: /mnt/raid1/nextcloud/index.php
[Thu Aug 01 10:20:48.352660 2019] [evasive20:error] [pid 16226:tid 1690047520] [client 94.218.6.2:52554] client denied by server configuration: /mnt/raid1/nextcloud/remote.php
[Thu Aug 01 10:20:48.652231 2019] [evasive20:error] [pid 16226:tid 1690047520] [client 94.218.6.2:52554] client denied by server configuration: /mnt/raid1/nextcloud/index.php
[Thu Aug 01 10:20:57.043626 2019] [evasive20:error] [pid 16226:tid 1690047520] [client 94.218.6.2:52562] client denied by server configuration: /mnt/raid1/nextcloud/ocs/v2.php
[Thu Aug 01 10:20:57.376298 2019] [evasive20:error] [pid 16226:tid 1690047520] [client 94.218.6.2:52562] client denied by server configuration: /mnt/raid1/nextcloud/index.php
[Thu Aug 01 10:40:34.596027 2019] [authz_core:error] [pid 16227:tid 1562346528] [client 162.243.145.134:37532] AH01630: client denied by server configuration: /var/www/html/
[Thu Aug 01 11:01:07.399680 2019] [authz_core:error] [pid 16227:tid 1528775712] [client 128.74.220.190:39035] AH01630: client denied by server configuration: /var/www/html/

Nextcloud worked fined on my Raspberry Pi 3 at home. I upgrade to 16.0.3 some weeks ago, everything worked, too. Since yesterday, my Desktop clients somehow can’t synchronize competely. The sync stops with errors. The client (2.5.2) says e.g.:

Error transferring https://x.com/index.php/apps/files/ - server replied: "

But there is nothing inside this quote.

At other times, I get error messages like:

[OCC::AbstractNetworkJob::slotFinished 	QNetworkReply::NetworkError(ContentAccessDenied) "Error transferring https://x.com/index.php/apps/files/ - server replied: " QVariant(int, 403)
[OCC::WebFlowCredentials::stillValid 	QNetworkReply::NetworkError(ContentAccessDenied)
[OCC::WebFlowCredentials::stillValid 	"Error transferring https://x.com/index.php/apps/files/ - server replied: "
[OCC::PUTFileJob::finished 	PUT of "https://x.com/index.php/apps/files/" FINISHED WITH STATUS "ContentAccessDenied Error transferring https://x.com/index.php/apps/files/ - server replied: " QVariant(int, 403) QVariant(QString, "")
[OCC::createBlacklistEntry 	Probably firewall error:  403 , blacklisting up to 1h only
[OCC::SyncJournalDb::setErrorBlacklistEntry 	Setting blacklist entry for  "23/TGI-E-CT/CT-alte_Daten_Server_Schule/ftdi_work/work/thread/thread_key.c" 1 "Error transferring https://x.com/index.php/apps/files/ - server replied: " 1564654830 25 1538178189 "" "" 0

If the Problem still persist try raising the “client_max_body_size” as described here.