Sabre\DAV\Exception\Forbidden error when syncing files

Nextcloud version (eg, 20.0.5): 27.1.3
Operating system and version (eg, Ubuntu 20.04): Linux 6.1.49-Unraid x86_64
Apache or nginx version (eg, Apache 2.4.25): replace me
PHP version (eg, 7.4): 8.2.10

The issue you are facing:
Cannot sync random files – “Sabre\DAV\Exception\Forbidden”

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

Steps to replicate it:

  1. Change a file
  2. Wait for desktop app to sync
  3. See error

The output of your Nextcloud log in Admin > Logging:

[no app in context] Error: Could not create path "/zkvvoob/files/Obsidian/zkvvoob/.obsidian/core-plugins.json"

POST /remote.php/dav/bulk
from 172.68.51.196 by zkvvoob at 2023-11-01T10:04:59+02:00

[PHP] Error: file_put_contents(/data/zkvvoob/files/Obsidian/zkvvoob/.obsidian/core-plugins.json): Failed to open stream: No such file or directory at /app/www/public/lib/private/Files/Storage/Local.php#313

POST /remote.php/dav/bulk
from 172.68.51.196 by zkvvoob at 2023-11-01T10:04:59+02:00

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

<?php
$CONFIG = array (
  'datadirectory' => '/data',
  'instanceid' => 'oc93ojww42pu',
  'passwordsalt' => 'ddd',
  'secret' => 'd+asd/sd',
  'trusted_domains' => 
  array (
    0 => '10.0.0.77:9443',
    1 => 'cloud.mydomain.com',
  ),
  'dbtype' => 'pgsql',
  'version' => '27.1.3.2',
  'overwrite.cli.url' => 'https://cloud.mydomain.com',
  'dbname' => 'nextcloud',
  'dbhost' => 'postgresql15',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => 'avf',
  'installed' => true,
  'default_language' => 'en',
  'default_locale' => 'en',
  'default_phone_region' => 'US',
  'mail_domain' => 'mydomain.com',
  'mail_from_address' => 'cloud',
  'mail_smtphost' => 'mail.mydomain.com',
  'mail_smtpport' => 587,
  'mail_smtpsecure' => 'ssl',
  'mail_smtpauth' => true,
  'mail_smtpname' => 'noreply@mydomain.com',
  'mail_smtppassword' => 'abv',
  'overwritehost' => 'cloud.mydomain.com',
  'overwriteprotocol' => 'https',
  'htaccess.RewriteBase' => '/',
  'logtimezone' => 'UTC',
  'filelocking.enabled' => 'true',
  'memcache.locking' => '\\OC\\Memcache\\APCu',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'redis',
    'port' => 6379,
    'timeout' => 0.0,
    'read_timeout' => 0.0,
    'user' => '',
    'password' => 'acd',
    'dbindex' => 3,
  ),
  'allow_user_to_change_display_name' => false,
  'lost_password_link' => 'disabled',
  'oidc_login_provider_url' => 'https://auth.mydomain.com',
  'oidc_login_client_id' => 'nextcloud',
  'oidc_login_client_secret' => 'abc',
  'oidc_login_auto_redirect' => true,
  'oidc_login_logout_url' => '',
  'oidc_login_end_session_redirect' => false,
  'oidc_login_default_quota' => '',
  'oidc_login_button_text' => 'Log in with Authelia',
  'oidc_login_hide_password_form' => true,
  'oidc_login_use_id_token' => false,
  'oidc_login_attributes' => 
  array (
    'id' => 'preferred_username',
    'name' => 'name',
    'mail' => 'email',
    'groups' => 'groups',
    'login_filter' => 'groups',
    'is_admin' => 'groups_admin',
  ),
  'oidc_login_default_group' => '',
  'oidc_login_filter_allowed_values' => 
  array (
    0 => 'admin',
    1 => 'nextcloud',
  ),
  'oidc_login_use_external_storage' => false,
  'oidc_login_scope' => 'openid email profile groups',
  'oidc_login_proxy_ldap' => false,
  'oidc_login_disable_registration' => false,
  'oidc_login_redir_fallback' => false,
  'oidc_login_alt_login_page' => 'assets/login.php',
  'oidc_login_tls_verify' => true,
  'oidc_create_groups' => false,
  'oidc_login_webdav_enabled' => false,
  'oidc_login_password_authentication' => false,
  'oidc_login_public_key_caching_time' => 86400,
  'oidc_login_min_time_between_jwks_requests' => 10,
  'oidc_login_well_known_caching_time' => 86400,
  'oidc_login_update_avatar' => false,
  'oidc_login_skip_proxy' => false,
  'oidc_login_code_challenge_method' => '',
  'maintenance' => false,
  'loglevel' => 2,
  'upgrade.disable-web' => true,
);

The output of your Apache/nginx/system log in /log/nginx/error.log:

No relevant entries in error.log

access.log

172.68.51.176 - - [01/Nov/2023:10:04:56 +0200] "GET /apps/logreader/poll?lastReqId=35btrISP2pvRG4osqX0Z HTTP/1.1" 200 22 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/119.0"
172.68.51.196 - zkvvoob [01/Nov/2023:10:04:59 +0200] "PROPFIND /remote.php/dav/files/zkvvoob/ HTTP/1.1" 207 1578 "-" "Mozilla/5.0 (Macintosh) mirall/3.10.1git (build 18409) (Nextcloud, osx-23.1.0 ClientArchitecture: arm64 OsArchitecture: arm64)"
172.68.51.196 - zkvvoob [01/Nov/2023:10:04:59 +0200] "POST /remote.php/dav/bulk HTTP/1.1" 200 208 "-" "Mozilla/5.0 (Macintosh) mirall/3.10.1git (build 18409) (Nextcloud, osx-23.1.0 ClientArchitecture: arm64 OsArchitecture: arm64)"
172.68.51.175 - - [01/Nov/2023:10:04:59 +0200] "GET /apps/logreader/poll?lastReqId=35btrISP2pvRG4osqX0Z HTTP/1.1" 200 702 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/119.0"
172.68.51.196 - zkvvoob [01/Nov/2023:10:05:01 +0200] "PROPFIND /remote.php/dav/files/zkvvoob/ HTTP/1.1" 207 1578 "-" "Mozilla/5.0 (Macintosh) mirall/3.10.1git (build 18409) (Nextcloud, osx-23.1.0 ClientArchitecture: arm64 OsArchitecture: arm64)"
172.68.51.196 - zkvvoob [01/Nov/2023:10:05:01 +0200] "PUT /remote.php/dav/files/zkvvoob/Obsidian/BZ/.obsidian/app.json HTTP/1.1" 403 169 "-" "Mozilla/5.0 (Macintosh) mirall/3.10.1git (build 18409) (Nextcloud, osx-23.1.0 ClientArchitecture: arm64 OsArchitecture: arm64)"

Output errors in nextcloud.log in /var/www/: nextcloud.log - Pastebin.com

Take a look at settings → excluded files.

Looks like the issue is related to .hidden folder

As in the Desktop app’s settings? I can’t see any restrictions there:

SCR-20231101-kam

Damn…

Had a similar issue with a folder of my father´s PC. He had an old Backup of Windows on his Harddisk and wanted to sync the folder to the Nextcloud.
didn´t work. Made a zip-file of the folder and could upload without any problems.

Maybe that´s the way, you could work around.

OK, that’s a workaround, but it doesn’t explain what the root cause is and how to avoid it in the future.

Anyone? Any ideas?