Upload to external storage works fine but files then (partially) disappear in Nextcloud

Nextcloud version: 29.0.2 (Recently updated, problem occurred also before)
Operating System: Linux 5.10.0-29-amd64 x86_64
CPU: AMD Ryzen 7 3700X 8-Core Processor (16 cores)
Memory: 62.77 GB
Apache or nginx version: Apache 2.4.57
PHP version : 8.2
Nextcloud desktop client: MacOS version 3.13.0

Hi all!

I am using a Hetzner Storagebox as an external drive for years now, having it mounted with SFTP. That has been working fine for most of the time, sometimes the loading delays (latency) seems high, but everything worked.

Since a few weeks, I am facing a difficulty when putting files in my local directory on my Mac that should be synced to the folder in my Nextcloud that is on the external storage. The files are uploaded but never fully appear in the directory when looking from the Browser. Instead, always a reduced number of files is displayed there. E.g., I exported 80 images yesterday to a new folder that was synced then. First, 60 images appeared on the Nextcloud Webinterface, then suddenly only 33 were left. Which the Desktop client adjusted for and removed the other ones, leaving me with 33 files on my Mac as well. So I began with 80 that should be uploaded and instead my Desktop client removed images from my local folder.

Weirdly enough, when looking at the folder at the Storagebox with SFTP directly, all 80 images are there.

When I then, manually ask for a rescan of the user, all 80 items reappear in Nextcloud, some with grey thumbnail.

/usr/bin/php82 occ files:scan [user]

When clicking on them, I get a “File not found” error in the top right corner. Then I was back at 63 images… After another full rescan, Nextcloud got the right number of 80 images.

All in all very weird and annoying behaviour. Any ideas? I tried to look at the permissions, but they seem fine as the upload itself works fine…

Is this the first time you’ve seen this error?: I’ve been having this error for some weeks now, tried some fixes, but nothing worked.

The output of my Nextcloud log in Admin > Logging: (Non-Debug Level)

Call to undefined method OC\Server::getEventDispatcher()
Could not boot files_downloadactivity: Call to undefined method OC\Server::getEventDispatcher()

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

$CONFIG = array (
  'simpleSignUpLink.shown' => false,
  'instanceid' => 'xx',
  'passwordsalt' => 'xx+l/xx+xx',
  'secret' => 'xx/xx/x',
  'trusted_domains' => 
  array (
    0 => 'xx.x',
  'datadirectory' => '/usr/www/users/xxx/xxx.cloud/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => 'https://xxx.cloud',
  'htaccess.RewriteBase' => '/',
  'installed' => true,
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' => 
  array (
  'twofactor_enforced_excluded_groups' => 
  array (
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 0,
  'trashbin_retention_obligation' => '30, auto',
  'versions_retention_obligation' => 'auto',
  'updater.release.channel' => 'stable',
  'app_install_overwrite' => 
  array (
    0 => 'twofactor_rcdevsopenotp',
    1 => 'files_trackdownloads',
    2 => 'ransomware_protection',
    3 => 'files_downloadactivity',
  'dbname' => 'xx',
  'dbhost' => 'xx.xx-xx.de',
  'dbuser' => 'xx',
  'dbpassword' => 'xx',
  'mysql.utf8mb4' => true,
  'encryption.legacy_format_support' => false,
  'encryption.key_storage_migrated' => false,

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

[Sun Jun 23 22:57:02.013985 2024] [core:crit] [pid 26178:tid 140223316989696] (13)Permission denied: [remote xx:30170] AH00529: /usr/www/users/xx/xx.xx/data/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/usr/www/users/xx/xx.xx/data/' is executable