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

Storage {} is invalid

Error message

Storage {} is invalid

What it means

Thrown by ObjectTree::getNodeForPath() (apps/dav/lib/Connector/Sabre/ObjectTree.php:116) as \Sabre\DAV\Exception\NotFound (HTTP 404) when getFileInfo() throws \OCP\Files\StorageInvalidException. Unlike StorageNotAvailableException, this signals the storage itself is invalid — not temporarily down — so the server answers 404 with 'Storage <path> is invalid': the mount cannot be used at all in its current state.

Source

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

				 */
				// get data directly
				$data = $storage->getMetaData($internalPath);
				$info = new FileInfo($absPath, $storage, $internalPath, $data, $mount);
			} else {
				$info = null;
			}
		} else {
			// read from cache
			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;

View on GitHub (pinned to ecdeb153ff)

Solutions

  1. Inspect nextcloud.log for the chained StorageInvalidException and identify which storage/mount the path belongs to (occ files_external:list).
  2. Restore the storage's root (recreate the deleted directory, or re-save the external mount so it gets a valid configuration).
  3. If the mount is permanently gone, remove it cleanly via Settings > External storage or occ files_external:delete <id>, then occ files:scan --user <uid> to reconcile the cache.
  4. Verify datadirectory/permissions in config.php if the invalid storage is the primary local root.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    $node = $server->tree->getNodeForPath($path);
} catch (\Sabre\DAV\Exception\NotFound $e) {
    if (str_contains($e->getMessage(), 'is invalid')) {
        // storage marked invalid: administrative repair needed, not a plain missing file
        $this->adminAlert->raise('Invalid storage for path ' . $path);
    } else {
        // genuine 404 handling
    }
}

Prevention

When it happens

Trigger: WebDAV access to a path whose storage reported itself invalid — e.g. a local storage whose root directory was deleted, or an external storage configuration that resolves to an unusable backend; typically triggered during getFileInfo() when the mount's storage id no longer matches a loadable storage.

Common situations: data directory or a mounted external root deleted/moved on disk while Nextcloud still has cache entries; external storage definitions corrupted after restoring a backup or database migration without the matching storage config; id mismatches between filecache storages and mounts after manual DB surgery.

Related errors


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