Windows Client not syncing files HTTP 416 error

Nextcloud version (eg, 18.0.2):

# pkg info www/nextcloud
nextcloud-php72-18.0.4
Name           : nextcloud-php72
Version        : 18.0.4
Installed on   : Wed May  6 16:45:28 2020 CEST
Origin         : www/nextcloud
Architecture   : FreeBSD:12:*
Prefix         : /usr/local
Categories     : www
Licenses       : AGPLv3
Maintainer     : brnrd@FreeBSD.org
WWW            : https://nextcloud.com
Comment        : Personal cloud which runs on your own server
Options        :
	APCU           : on
	EXIF           : on
	IMAGICK        : off
	INTL           : on
	LDAP           : on
	MEMCACHED      : off
	MYSQL          : on
	OPCACHE        : on
	PCNTL          : off
	PGSQL          : off
	REDIS          : off
	SMB            : off
	SQLITE         : off
	SSL            : on
Annotations    :
	cpe            : cpe:2.3:a:nextcloud:nextcloud:18.0.4:::::freebsd12:x64
	flavor         : php72
	repo_type      : binary
	repository     : FreeBSD
Flat size      : 245MiB
Description    :
Nextcloud is a system for the creation and management of personal
cloud resources. It is a fork of Owncloud.

WWW: https://nextcloud.com

Operating system and version (eg, Ubuntu 20.04):

# uname -mrsv
FreeBSD 12.1-RELEASE-p5 FreeBSD 12.1-RELEASE-p5 GENERIC  amd64

Apache or nginx version (eg, Apache 2.4.25):

# apachectl -V
Server version: Apache/2.4.43 (FreeBSD)
Server built:   unknown
Server's Module Magic Number: 20120211:92
Server loaded:  APR 1.7.0, APR-UTIL 1.6.1
Compiled using: APR 1.7.0, APR-UTIL 1.6.1
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses disabled)
 -D APR_USE_FLOCK_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/usr/local"
 -D SUEXEC_BIN="/usr/local/bin/suexec"
 -D DEFAULT_PIDLOG="/var/run/httpd.pid"
 -D DEFAULT_SCOREBOARD="/var/run/apache_runtime_status"
 -D DEFAULT_ERRORLOG="/var/log/httpd-error.log"
 -D AP_TYPES_CONFIG_FILE="etc/apache24/mime.types"
 -D SERVER_CONFIG_FILE="etc/apache24/httpd.conf"

PHP version (eg, 7.1):

# php --version
PHP 7.2.31 (cli) (built: May 19 2020 01:13:22) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.31, Copyright (c) 1999-2018, by Zend Technologies

Owncloud client:

Version 2.6.4stable-Win64 (build 20200303). For more information please click here.
This release was supplied by Nextcloud GmbH
Built from Git revision b45f5f on Mar 3 2020, 20:59:52 using Qt 5.12.5, OpenSSL 1.1.1d 10 Sep 2019

Client version:

PS C:\Users\info> Get-WmiObject Win32_OperatingSystem |
>> Select Caption, OSArchitecture, Version, BuildNumber | FL


Caption        : Microsoft Windows 10 Pro
OSArchitecture : 64-bit
Version        : 10.0.18363
BuildNumber    : 18363        

The issue you are facing:
No files are beeing downloaded from the client, client give error messages:

[OCC::ActivityWidget::slotItemCompleted 	Item  "REMOVED-PRIVACY"  retrieved resulted in  "The file could not be downloaded completely."
[OCC::ActivityWidget::slotItemCompleted 	Item  "REMOVED-PRIVACY"  retrieved resulted in error  "The file could not be downloaded completely."

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

Steps to replicate it:

  1. Change file (using other client).
  2. Start client (was previously synced)
  3. See errors

The output of your Nextcloud log in Admin > Logging:

[webdav] Fatal: Sabre\DAV\Exception\RequestedRangeNotSatisfiable: The start offset (508286) exceeded the size of the entity (508008) at <<closure>>

0. <<closure>>
   Sabre\DAV\CorePlugin->httpGet(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
1. /usr/local/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
   call_user_func_array([Sabre\DAV\CorePlugin {},"httpGet"], [Sabre\HTTP\Requ ... }])
2. /usr/local/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479
   Sabre\Event\EventEmitter->emit("method:GET", [Sabre\HTTP\Requ ... }])
3. /usr/local/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254
   Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
4. /usr/local/www/nextcloud/apps-pkg/dav/lib/Server.php line 319
   Sabre\DAV\Server->exec()
5. /usr/local/www/nextcloud/apps-pkg/dav/appinfo/v2/remote.php line 35
   OCA\DAV\Server->exec()
6. /usr/local/www/nextcloud/remote.php line 165
   require_once("/usr/local/www/ ... p")

GET /nextcloud/remote.php/dav/files/PRIVACY-DETAILS-REMOVED'
from PRIVACY-DETAILS-REMOVED' by rick at 2020-06-04T12:28:15+00:00

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

<?php
$CONFIG = array (
  'instanceid' => 'PRIVACY-DETAILS-REMOVED',
  'passwordsalt' => 'PRIVACY-DETAILS-REMOVED',
  'datadirectory' => '/local0/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '18.0.4.2',
  'installed' => true,
  'maintenance' => false,
  'forcessl' => true,
  'theme' => '',
  'maxZipInputSize' => 838860800,
  'allowZipDownload' => true,
  'trusted_domains' => 
  array (
    0 => 'www.PRIVACY-DETAILS-REMOVED',
    1 => 'PRIVACY-DETAILS-REMOVED',
  ),
  'secret' => 'PRIVACY-DETAILS-REMOVED',
  'dbname' => 'nextcloud',
  'dbhost' => 'PRIVACY-DETAILS-REMOVED',
  'dbuser' => 'PRIVACY-DETAILS-REMOVED',
  'dbpassword' => 'PRIVACY-DETAILS-REMOVED',
  'mail_from_address' => 'nextcloud',
  'mail_smtpmode' => 'sendmail',
  'mail_domain' => 'PRIVACY-DETAILS-REMOVED',
  'loglevel' => 0,
  'trashbin_retention_obligation' => '30, 90',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'htaccess.RewriteBase' => '/nextcloud',
  'overwrite.cli.url' => 'https://PRIVACY-DETAILS-REMOVED/nextcloud',
  'appstoreenabled' => true,
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/usr/local/www/nextcloud/apps',
      'url' => '/apps',
      'writable' => true,
    ),
    1 => 
    array (
      'path' => '/usr/local/www/nextcloud/apps-pkg',
      'url' => '/apps-pkg',
      'writable' => false,
    ),
  ),
  'mysql.utf8mb4' => true,
);
?>

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

001:984:ac89:ffff:8cb4:9ad6:e571:842a - rick [04/Jun/2020:14:42:08 +0200] "GET /nextcloud/ocs/v2.php/apps/notifications/api/v2/notifications?format=json HTTP/1.1" 304 -
2001:984:ac89:ffff:8cb4:9ad6:e571:842a - rick [04/Jun/2020:14:42:08 +0200] "PROPFIND /nextcloud/remote.php/dav/files/rick/ HTTP/1.1" 207 3245
2001:984:ac89:ffff:8cb4:9ad6:e571:842a - rick [04/Jun/2020:14:42:09 +0200] "PROPFIND /nextcloud/remote.php/dav/files/rick/AnyWi HTTP/1.1" 207 21447
2001:984:ac89:ffff:8cb4:9ad6:e571:842a - rick [04/Jun/2020:14:42:09 +0200] "PROPFIND /nextcloud/remote.php/dav/files/PRIVACY-DETAILS-REMOVED HTTP/1.1" 207 2120
2001:984:ac89:ffff:8cb4:9ad6:e571:842a - rick [04/Jun/2020:14:42:09 +0200] "GET /nextcloud/remote.php/dav/files//PRIVACY-DETAILS-REMOVED HTTP/1.1" 416 272
2001:984:ac89:ffff:8cb4:9ad6:e571:842a - rick [04/Jun/2020:14:42:09 +0200] "GET /nextcloud/remote.php/dav/files//PRIVACY-DETAILS-REMOVED HTTP/1.1" 416 278


Workaround:

  1. Account -> Logout
  2. Account -> Remove
  3. Re-install account

Maybe not related yet interesting to note, there is a HTTP-redirect occuring al well (apache server configuration):

[OCC::AbstractNetworkJob::slotFinished Redirecting "GET" QUrl("https://DOMAIN.REMOVED/nextcloud/remote.php/dav/files/FILE-REMOVED") QUrl("https://www.DOMAIN.REMOVED/nextcloud/remote.php/dav/files/FILE-REMOVED")

I only found a very old reference for this error that dates back before Nextcloud was forked from ownCloud:

Just to clarify a few points:

  • the file that can’t be retrieved is the one that was changed?
  • does it happen to all the changed files, or just a few one?
  • does it happen all the time, doesn’t depend on file type, file size, …?
  • can you retrieve these files directly via webdav (WinSCP, …)?

Could be something for the bug tracker as well…

the file that can’t be retrieved is the one that was changed?

Yes.

does it happen to all the changed files, or just a few one?

It does happen on alle files.

does it happen all the time, doesn’t depend on file type, file size, …?

It happens all the time.

can you retrieve these files directly via webdav (WinSCP, …)?

Yes, works fine.

The most annoying thing about the bug, it’s not easy reproducible, since I have re-installed the account I have seen no more error messages.