{"record":{"id":"a9ea49e60dbfdb02","repo":"nextcloud/server","slug":"file-with-name-could-not-be-located-a9ea49","errorCode":null,"errorMessage":"File with name {} could not be located","messagePattern":"File with name (.+?) could not be located","errorType":"exception","errorClass":"Sabre\\DAV\\Exception\\NotFound","httpStatus":404,"severity":"warning","filePath":"apps/dav/lib/Connector/Sabre/ObjectTree.php","lineNumber":125,"sourceCode":"\t\t\ttry {\n\t\t\t\t$info = $this->fileView->getFileInfo($path);\n\n\t\t\t\tif ($info instanceof \\OCP\\Files\\FileInfo && $info->getStorage()->instanceOfStorage(FailedStorage::class)) {\n\t\t\t\t\tthrow new StorageNotAvailableException();\n\t\t\t\t}\n\t\t\t} catch (StorageNotAvailableException $e) {\n\t\t\t\tthrow new \\Sabre\\DAV\\Exception\\ServiceUnavailable('Storage is temporarily not available', 0, $e);\n\t\t\t} catch (StorageInvalidException $e) {\n\t\t\t\tthrow new \\Sabre\\DAV\\Exception\\NotFound('Storage ' . $path . ' is invalid');\n\t\t\t} catch (LockedException $e) {\n\t\t\t\tthrow new \\Sabre\\DAV\\Exception\\Locked();\n\t\t\t} catch (ForbiddenException $e) {\n\t\t\t\tthrow new \\Sabre\\DAV\\Exception\\Forbidden();\n\t\t\t}\n\t\t}\n\n\t\tif (!$info) {\n\t\t\tthrow new \\Sabre\\DAV\\Exception\\NotFound('File with name ' . $path . ' could not be located');\n\t\t}\n\n\t\tif ($info->getType() === 'dir') {\n\t\t\t$node = new Directory($this->fileView, $info, $this);\n\t\t} else {\n\t\t\t$node = new File($this->fileView, $info);\n\t\t}\n\n\t\t$this->cache[$path] = $node;\n\t\treturn $node;\n\t}\n\n\t/**\n\t * Copies a file or directory.\n\t *\n\t * This method must work recursively and delete the destination\n\t * if it exists\n\t *","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/dav/lib/Connector/Sabre/ObjectTree.php#L107-L143","documentation":"Thrown by ObjectTree::getNodeForPath() (apps/dav/lib/Connector/Sabre/ObjectTree.php:125) as \\Sabre\\DAV\\Exception\\NotFound (HTTP 404) when fileView->getFileInfo($path) returned a falsy value without throwing. The path lookup completed but no FileInfo could be produced — the file genuinely is not there as far as the filesystem/cache is concerned.","triggerScenarios":"GET/PROPFIND on a file deleted moments before (client cache stale after another device removed it); a path that never existed (client-side ghost entry); filecache/cache inconsistency where the parent dir lists an entry but getFileInfo can no longer resolve it (e.g. after crashes during delete).","commonSituations":"Two devices syncing: device A deletes, device B still issues a request; interrupted deletions or moves leaving stale cache entries; clients constructing paths from old listings after a remote rename; race between PROPFIND listing and subsequent GET.","solutions":["Re-list the parent folder (PROPFIND depth 1) and update local state; if the file is gone, remove the local ghost entry or re-upload if it should exist.","If the file definitely exists in the web UI but DAV says 404, run occ files:scan --user <uid> to rebuild the file cache for that user.","In client code, treat 404 on GET as authoritative and reconcile instead of retrying.","Check the trashbin (remote.php/dav/trash-bin/) if the file was deleted and needs restoring."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    $node = $server->tree->getNodeForPath($path);\n} catch (\\Sabre\\DAV\\Exception\\NotFound $e) {\n    // authoritative absence: re-list parent and reconcile local state\n    $this->refreshFolderListing(dirname($path));\n    $this->localState->removeGhost($path);","preventionTips":["Re-list (PROPFIND depth 1) before acting on cached paths older than the last sync.","Treat 404 on GET/PROPFIND as authoritative and reconcile instead of retrying.","Check the trashbin before re-uploading irreplaceable files."],"tags":["dav","not-found","http-404","sync-conflict","stale-cache"],"backgroundTag":"file-not-found","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}