File or directory not found

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 12.0.2): 15.0.12
Operating system and version (eg, Ubuntu 17.04): Ubuntu 16.04.6
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.18
PHP version (eg, 7.1): 7.3

The issue you are facing:

Cannot access some files in web interface, nor sync in client.
About one week ago the sync client started to complain about "File or directory not found: " of one of my directories. I can see/open the files both on my laptop as well on my server (directly accessing /nextcloud/user/files/…). I have also not modified the files since after I installed Nextcloud, and user and permissions are same as for other files.
If I try to access the directory from web interface the “loading circle icon” will rotate forever.
If I try to access the file on my iphone client app I immediately get “Request failed: not found (404)” error.
In the desktop client it looks like this:

I have tried occ files:scan without any difference.

My thought is that this directory reference for some reason has gone missing from the database. If someone have had same experience or can lead me in some direction, please help!

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

Steps to replicate it:
Don’t know

The output of your Nextcloud log in Admin > Logging:
No particular error in this log.

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

config.php
$CONFIG = array (
  'instanceid' => 'xxxxxxxxxxxx',
  'passwordsalt' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  'trusted_domains' => 
  array (
    0 => '192.168.1.215',
    1 => 'localhost',
  ),
  'datadirectory' => '/nextcloud/data',
  'overwrite.cli.url' => 'http://192.168.1.215',
  'htaccess.RewriteBase' => '/',
  'dbtype' => 'mysql',
  'version' => '15.0.12.1',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'xxxxx',
  'dbpassword' => 'xxxxxxxxxxxxxxxxxxxx',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mail_smtpmode' => 'php',
  'mail_smtpauthtype' => 'LOGIN',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'log_rotate_size' => 10485760,
  'enable_previews' => true,
  'preview_max_x' => 1024,
  'preview_max_y' => 1024,
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' => 
  array (
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
  'updater.release.channel' => 'stable',
);

The output of your Apache/nginx/system log in /var/log/____:
From access.log when trying to access directory:

192.168.1.112 - - [03/Oct/2019:22:34:10 +0900] "PROPFIND /remote.php/webdav/Dokument/xxxxxxxxxxxxxxxxxxxxxxxxxxx/.git HTTP/1.1" 404 616 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/2.24.1"

No error messages in error.log.

Here is sync log from Nextcloud client (2.5 for linux) after doing a forced sync:

client sync log
[_csync_detect_update 	Database entry found for xxxxxxxxxxxxxxxxxxxxxxxxxxx/.git, compare: 1522149914 <-> 1522149914, etag: 5aba2a1af292c <-> _invalid_, inode: 0 <-> 3413553, size: 0 <-> 0, perms: fd <-> fd, checksum:  <->  , ignore: 0,  e2e: 
[_csync_detect_update 	file: xxxxxxxxxxxxxxxxxxxxxxxxxxx/.git, instruction: INSTRUCTION_EVAL <<=
[OCC::AccessManager::createRequest 	6 "PROPFIND" "https://xxxxxxxxxxxxxxx/remote.php/dav/files/hans/Dokument/xxxxxxxxxxxxxxxxxxxxxxxxxxx/.git" has X-Request-ID "83ee2b79-d223-41fd-b1a5-9dac69d2d490"
[OCC::AbstractNetworkJob::start 	OCC::LsColJob created for "https://xxxxxxxxxxxxxxx" + "/Dokument/xxxxxxxxxxxxxxxxxxxxxxxxxxx/.git" "OCC::DiscoverySingleDirectoryJob"
[OCC::WebFlowCredentials::slotFinished 	request finished
[OCC::AbstractNetworkJob::slotFinished 	QNetworkReply::NetworkError(ContentNotFoundError) "Servern svarade \"404 Not Found\" på \"PROPFIND https://xxxxxxxxxxxxxxx/remote.php/dav/files/hans/Dokument/xxxxxxxxxxxxxxxxxxxxxxxxxxx/.git\"" QVariant(int, 404)
[OCC::WebFlowCredentials::stillValid 	QNetworkReply::NetworkError(ContentNotFoundError)
[OCC::WebFlowCredentials::stillValid 	"Error transferring https://xxxxxxxxxxxxxxx/remote.php/dav/files/hans/Dokument/xxxxxxxxxxxxxxxxxxxxxxxxxxx/.git - server replied: Not Found"
[OCC::LsColJob::finished 	LSCOL of QUrl("https://xxxxxxxxxxxxxxx/remote.php/dav/files/hans/Dokument/xxxxxxxxxxxxxxxxxxxxxxxxxxx/.git") FINISHED WITH STATUS "ContentNotFoundError Servern svarade \"404 Not Found\" på \"PROPFIND https://xxxxxxxxxxxxxxx/remote.php/dav/files/hans/Dokument/xxxxxxxxxxxxxxxxxxxxxxxxxxx/.git\""
[OCC::DiscoverySingleDirectoryJob::lsJobFinishedWithErrorSlot 	LSCOL job error "Error transferring https://xxxxxxxxxxxxxxx/remote.php/dav/files/hans/Dokument/xxxxxxxxxxxxxxxxxxxxxxxxxxx/.git - server replied: Not Found" 404 QNetworkReply::NetworkError(ContentNotFoundError)
[OCC::SyncEngine::handleSyncError 	ERROR during  csync_update :  "Fil eller mapp kunde inte hittas: xxxxxxxxxxxxxxxxxxxxxxxxxxx/.git"
[OCC::ActivityWidget::addError 	Item  "Dokument"  retrieved resulted in  "Fil eller mapp kunde inte hittas: xxxxxxxxxxxxxxxxxxxxxxxxxxx/.git"
[OCC::ActivityListModel::addErrorToActivityList 	Error successfully added to the notification list:  "Fil eller mapp kunde inte hittas: xxxxxxxxxxxxxxxxxxxxxxxxxxx/.git"
[OCC::SyncJournalDb::close 	Closing DB "/home/hans/Dokument/._sync_9629db275513.db"
[OCC::SyncEngine::finalize 	CSync run took  37642 ms
[OCC::Folder::slotSyncFinished 	Client version 2.5.2git  Qt 5.9.5  SSL  OpenSSL 1.1.1  11 Sep 2018
[OCC::Folder::slotSyncFinished 	SyncEngine finished with ERROR
[OCC::Folder::showSyncResultPopup 	Folder sync result:  2
[OCC::Folder::slotSyncFinished 	the last 4 syncs failed

I have solved this issue now. Just a stupid setting from me, which I realized when another folder named .git failed.

In my Apache configuration I had added

RedirectMatch 404 /\.git

for another part of my server (outside Nextcloud) as an Alias, but the line was put outside the Alias directive, ie affecting Nextcloud installation as well.
I did this months ago, but got into troubles recently, strange I didn’t notice earlier.

Same issue, but for a different reason. It’s not due to any apache redirects or denies as far as I can find, and I’m not getting any 404 hits in the access log like @hasse was.

I’m using Nginx, and the only denies/redirects I can find relate to Let’sEncrypt:

#/usr/local/hestia/data/templates/web/nginx/default.tpl
server {
    listen      %ip%:%proxy_port%;
    server_name %domain_idn% %alias_idn%;

    include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;

    location / {
        proxy_pass      http://%ip%:%web_port%;
        location ~* ^.+\.(%proxy_extensions%)$ {
            root           %docroot%;
            access_log     /var/log/%web_system%/domains/%domain%.log combined;
            access_log     /var/log/%web_system%/domains/%domain%.bytes bytes;
            expires        max;
            try_files      $uri @fallback;
        }
    }

    location /error/ {
        alias   %home%/%user%/web/%domain%/document_errors/;
    }

    location @fallback {
        proxy_pass      http://%ip%:%web_port%;
    }

    location ~ /\.(?!well-known\/|file) {
       deny all;
       return 404;
    }

    include %home%/%user%/conf/web/%domain%/nginx.conf_*;
}

I have a few TB of data on the server (data dir outside of web root), and these are the exceptions I’ve had to add to the desktop sync client in order to get through a sync with my (linux) desktop:

.git
.github
.Trash-*
.backups
.ethanon
.thumbs
.thumbnails
.deps
.libs
.Contacts-Backup
.icn
.metadata
.settings
.sencha

When I invetigate those “File or directory not found” locations, they are there and accessible, like this: (.deps & .libs exception from above)

root@hostname:/home/webuser/web/domain.name/public_html# ls -als ../data/username/files/path/to/hplip-3.19.6/
total 32388
  20 drwxr----- 24 webuser webuser   20480 Jul 30  2019 .
   4 drwxr-xr-x  3 webuser webuser    4096 Jan  1  2020 ..
-some lines removed for length-
   4 drwxr----- 10 webuser webuser    4096 Jun 26  2019 data
  20 -rwxr-----  1 webuser webuser   18615 Nov  5  2018 depcomp
  12 drwxr-xr-x  2 webuser webuser   12288 Jul 30  2019 .deps
   4 -rwxr-----  1 webuser webuser    2744 Jun 26  2019 devicesettings.py
   4 -rwxr-----  1 webuser webuser    3859 Jun 26  2019 diagnose_plugin.py
-some lines removed for length-
   4 -rw-r--r--  1 webuser webuser     298 Jul 30  2019 libhpmud_la-pp.lo
   4 -rw-r--r--  1 webuser webuser     304 Jul 30  2019 libhpmud_la-utils.lo
  12 drwxr-xr-x  2 webuser webuser   12288 Jul 30  2019 .libs
   4 -rw-r--r--  1 webuser webuser    2116 Jul 30  2019 libsane-hpaio.la
   4 -rw-r--r--  1 webuser webuser     318 Jul 30  2019 libsane_hpaio_la-bb_ledm.lo
-some lines removed for length-
root@hostname:/home/webuser/web/domain.name/public_html# ls -als ../data/username/files/path/to/hplip-3.19.6/.deps
total 2364
12 drwxr-xr-x  2 webuser webuser 12288 Jul 30  2019 .
20 drwxr----- 24 webuser webuser 20480 Jul 30  2019 ..
20 -rw-r--r--  1 webuser webuser 19293 Jul 30  2019 cupsext_la-cupsext.Plo
20 -rw-r--r--  1 webuser webuser 18393 Jul 30  2019 dat2drv-Dat2drv.Po
20 -rw-r--r--  1 webuser webuser 18375 Jul 30  2019 dat2drv-Normalize.Po
12 -rw-r--r--  1 webuser webuser  8602 Jul 30  2019 fat.Po
 4 -rw-r--r--  1 webuser webuser   109 Jul 30  2019 hpcups-BreakTables.Po
-some lines removed for length-
root@hostname:/home/webuser/web/domain.name/public_html# ls -als ../data/username/files/path/to/hplip-3.19.6/.libs
total 22476
  12 drwxr-xr-x  2 webuser webuser   12288 Jul 30  2019 .
  20 drwxr----- 24 webuser webuser   20480 Jul 30  2019 ..
   0 lrwxrwxrwx  1 webuser webuser      13 Jul 30  2019 cupsext.la -> ../cupsext.la
 172 -rw-r--r--  1 webuser webuser  174600 Jul 30  2019 cupsext_la-cupsext.o
   4 -rw-r--r--  1 webuser webuser    1055 Jul 30  2019 cupsext.lai
 128 -rwxr-xr-x  1 webuser webuser  129288 Jul 30  2019 cupsext.so
 128 -rwxr-xr-x  1 webuser webuser  129288 Jul 30  2019 cupsext.soT
-some lines removed for length-

When I try to access one of those “Not Found” hidden directories in the NC web interface, it acts like a loop and redirects me to the files home instead of loading the directory. When that happens, this is the only thing that shows up in access/error logs:

X.X.X.X - - [29/Apr/2022:11:38:51 -0500] "PROPFIND /remote.php/dav/files/username/path/to/hplip-3.19.6 HTTP/1.0" 207 17156 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"
X.X.X.X - - [29/Apr/2022:11:39:09 -0500] "GET /index.php/apps/files/ajax/getstoragestats.php?dir=%2Fpath%2Fto%2Fhplip-3.19.6 HTTP/1.0" 200 1153 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"
X.X.X.X - - [29/Apr/2022:11:39:39 -0500] "GET /index.php/apps/files/ajax/getstoragestats.php?dir=%2Fpath%2Fto%2Fhplip-3.19.6 HTTP/1.0" 200 1153 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"

The parent directory (e.g: /home/webuser/web/domain.name/data/username/files/path/to/hplip-3.19.6) that contains any of those “Not Found” hidden directories (e.g: .libs) takes an extrememly long time to load, like it’s stuck in a loop for a minute or so until it breaks out and completes the parent directory loading.

The site error log does show some “timeout” entries every so often (1 or 2 a day), but I haven’t been able to correlate the timestamps with the “Not Found” issues so I don’t think it’s related. Mentioning the errors anyways just in case:

root@hostname:/home/webuser/web/domain.name/public_html# ../logs/domain.name.error.log
[Sat Apr 30 12:11:33.203878 2022] [proxy_fcgi:error] [pid 102619:tid 139989358737152] (70007)The timeout specified has expired: [client X.X.X.X:0] AH01075: Error dispatching request to : (polling)

Nextcloud version: 24.0.0rc2
Operating system and version: Debian 11.3
LAMP/Web Manager: HestaiCP
Apache or nginx version: Apache 2.4.53 (used for HestiaCP Admin Panel) & Nginx 1.21.6
PHP version: 8.0.18 (HestiaCP setup as multi-PHP 5.6-8.1)

They all seem to be hidden directories. 99% of hidden directories/files work fine, with only these few exceptions.

With words like “backup”, “settings”, “metadata”, and “trash” in some of the directories with issues, it does seem like a there could be a deny/“redirect to files home” regex in effect somewhere. But I don’t think that explains all of them. Either I have the same issue as @hasse and I’m just not looking in the right place, or I have different issue that resembles @hasse 's issue.

What can I check to narrow it down more? Thanks in advance for the replies!

Still no luck. Haven’t found any rules forbidding those directories, and haven’t found any hints indicating why in any related log files.

What else can I check?