nextcloud/server · warning · Sabre\DAV\Exception\NotFound

File with name {} could not be located

Error message

File with name {} could not be located

What it means

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.

Source

Thrown at apps/dav/lib/Connector/Sabre/ObjectTree.php:125

			try {
				$info = $this->fileView->getFileInfo($path);

				if ($info instanceof \OCP\Files\FileInfo && $info->getStorage()->instanceOfStorage(FailedStorage::class)) {
					throw new StorageNotAvailableException();
				}
			} catch (StorageNotAvailableException $e) {
				throw new \Sabre\DAV\Exception\ServiceUnavailable('Storage is temporarily not available', 0, $e);
			} catch (StorageInvalidException $e) {
				throw new \Sabre\DAV\Exception\NotFound('Storage ' . $path . ' is invalid');
			} catch (LockedException $e) {
				throw new \Sabre\DAV\Exception\Locked();
			} catch (ForbiddenException $e) {
				throw new \Sabre\DAV\Exception\Forbidden();
			}
		}

		if (!$info) {
			throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located');
		}

		if ($info->getType() === 'dir') {
			$node = new Directory($this->fileView, $info, $this);
		} else {
			$node = new File($this->fileView, $info);
		}

		$this->cache[$path] = $node;
		return $node;
	}

	/**
	 * Copies a file or directory.
	 *
	 * This method must work recursively and delete the destination
	 * if it exists
	 *

View on GitHub (pinned to ecdeb153ff)

Solutions

  1. 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.
  2. 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.
  3. In client code, treat 404 on GET as authoritative and reconcile instead of retrying.
  4. Check the trashbin (remote.php/dav/trash-bin/) if the file was deleted and needs restoring.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    $node = $server->tree->getNodeForPath($path);
} catch (\Sabre\DAV\Exception\NotFound $e) {
    // authoritative absence: re-list parent and reconcile local state
    $this->refreshFolderListing(dirname($path));
    $this->localState->removeGhost($path);

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of nextcloud/server@ecdeb153ff (2026-08-17). Data as JSON: /api/errors/a9ea49e60dbfdb02. Report an issue: GitHub.