{"record":{"id":"af1fd6f38ce5a67f","repo":"nextcloud/server","slug":"filesystem-not-setup","errorCode":null,"errorMessage":"filesystem not setup","messagePattern":"filesystem not setup","errorType":"exception","errorClass":"Sabre\\DAV\\Exception\\ServiceUnavailable","httpStatus":503,"severity":"error","filePath":"apps/dav/lib/Connector/Sabre/ObjectTree.php","lineNumber":67,"sourceCode":"\t\t$this->rootNode = $rootNode;\n\t\t$this->fileView = $view;\n\t\t$this->mountManager = $mountManager;\n\t}\n\n\t/**\n\t * Returns the INode object for the requested path\n\t *\n\t * @param string $path\n\t * @return \\Sabre\\DAV\\INode\n\t * @throws InvalidPath\n\t * @throws \\Sabre\\DAV\\Exception\\Locked\n\t * @throws \\Sabre\\DAV\\Exception\\NotFound\n\t * @throws \\Sabre\\DAV\\Exception\\ServiceUnavailable\n\t */\n\t#[\\Override]\n\tpublic function getNodeForPath($path) {\n\t\tif (!$this->fileView) {\n\t\t\tthrow new \\Sabre\\DAV\\Exception\\ServiceUnavailable('filesystem not setup');\n\t\t}\n\n\t\t$path = trim($path, '/');\n\n\t\tif (isset($this->cache[$path])) {\n\t\t\treturn $this->cache[$path];\n\t\t}\n\n\t\tif ($path) {\n\t\t\ttry {\n\t\t\t\t$this->fileView->verifyPath($path, basename($path));\n\t\t\t} catch (InvalidPathException $ex) {\n\t\t\t\tthrow new InvalidPath($ex->getMessage());\n\t\t\t}\n\t\t}\n\n\t\t// Is it the root node?\n\t\tif (!strlen($path)) {","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/dav/lib/Connector/Sabre/ObjectTree.php#L49-L85","documentation":"Thrown by ObjectTree::getNodeForPath() (apps/dav/lib/Connector/Sabre/ObjectTree.php:67) as \\Sabre\\DAV\\Exception\\ServiceUnavailable (HTTP 503) when the tree's $this->fileView is null — i.e. the per-user filesystem view (OC\\Files\\View) was never attached to the DAV tree. The Sabre object tree cannot resolve any path without it, so every WebDAV request touching /remote.php/dav/files/ fails before any storage access happens.","triggerScenarios":"The DAV server was constructed and getNodeForPath() called before init($rootFolder, $view) ran — e.g. a custom entry point or unit test instantiating ObjectTree directly; or the user filesystem setup failed during request bootstrap so no view was handed to the tree.","commonSituations":"Developers writing custom Sabre plugins or CLI/bootstrap code that reuse the DAV server outside apps/dav/lib/Server::requestPath flow; broken or half-finished maintenance-mode setups where user mounting is skipped; upgrades where an app unsets the root node; tests that forget Server::get(IServerContainer)->getRootFolder() wiring.","solutions":["Ensure ObjectTree::init() is called with a valid OC\\Files\\View for the logged-in user before any DAV request is served — in standard Nextcloud this is done by apps/dav/lib/Server/SetupManager and the root collection; verify you are going through apps/dav/lib/Server.php bootstrap.","If you have custom code instantiating the DAV server, mirror the core flow: build the user root via \\OC\\Files\\Filesystem::getView() (or IRootFolder->getUserFolder()) and pass it to the tree.","Check nextcloud.log for earlier errors during user/filesystem setup (e.g. failing lazy-user or setup:backends) that abort view creation before the DAV phase.","After an upgrade, run occ upgrade and occ files:scan --all to make sure the filesystem layer is intact."],"exampleFix":"// before (custom bootstrap)\n$tree = new ObjectTree();\n$server->tree = $tree; // fileView is null -> 503 'filesystem not setup'\n\n// after\n$view = \\OC\\Files\\Filesystem::getView(); // initialized for the current user\n$tree = new ObjectTree();\n$tree->init($rootFolder, $view);","handlingStrategy":"validation","validationCode":"// server-side, before serving DAV requests\n$view = \\OC\\Files\\Filesystem::getView();\nif (!$view) {\n    throw new \\RuntimeException('User filesystem not initialized - abort before DAV dispatch');\n}\n$tree->init($rootFolder, $view);","typeGuard":null,"tryCatchPattern":"try {\n    $node = $server->tree->getNodeForPath($path);\n} catch (\\Sabre\\DAV\\Exception\\ServiceUnavailable $e) {\n    if (str_contains($e->getMessage(), 'filesystem not setup')) {\n        // bootstrap bug: fix tree init, do not retry\n        throw new \\LogicException('DAV tree used before init()', 0, $e);\n    }\n    throw $e; // genuine storage 503 -> retryable\n}","preventionTips":["Always bootstrap the DAV server through apps/dav/lib/Server.php, not by instantiating ObjectTree yourself.","In tests, call ObjectTree::init() with a real or mocked view before any request.","Fail fast at bootstrap if the user root folder cannot be obtained."],"tags":["dav","filesystem","initialization","service-unavailable","sabre-tree"],"backgroundTag":"filesystem-not-initialized","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}