{"record":{"id":"c6b56c2989f6654a","repo":"nextcloud/server","slug":"entity-does-not-exist-or-is-not-available","errorCode":null,"errorMessage":"Entity does not exist or is not available","messagePattern":"Entity does not exist or is not available","errorType":"http","errorClass":"Sabre\\DAV\\Exception\\NotFound","httpStatus":404,"severity":"warning","filePath":"apps/dav/lib/Comments/EntityTypeCollection.php","lineNumber":60,"sourceCode":"\t\t$this->name = $name;\n\t\t$this->commentsManager = $commentsManager;\n\t\t$this->userSession = $userSession;\n\t}\n\n\t/**\n\t * Returns a specific child node, referenced by its name\n\t *\n\t * This method must throw Sabre\\DAV\\Exception\\NotFound if the node does not\n\t * exist.\n\t *\n\t * @param string $name\n\t * @return \\Sabre\\DAV\\INode\n\t * @throws NotFound\n\t */\n\t#[\\Override]\n\tpublic function getChild($name) {\n\t\tif (!$this->childExists($name)) {\n\t\t\tthrow new NotFound('Entity does not exist or is not available');\n\t\t}\n\t\treturn new EntityCollection(\n\t\t\t$name,\n\t\t\t$this->name,\n\t\t\t$this->commentsManager,\n\t\t\t$this->userManager,\n\t\t\t$this->userSession,\n\t\t\t$this->logger\n\t\t);\n\t}\n\n\t/**\n\t * Returns an array with all the child nodes\n\t *\n\t * @return \\Sabre\\DAV\\INode[]\n\t * @throws MethodNotAllowed\n\t */\n\t#[\\Override]","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/dav/lib/Comments/EntityTypeCollection.php#L42-L78","documentation":"Before handing out an object's comment collection, EntityTypeCollection::getChild() asks the entity type's childExists callback (registered per entity, e.g. by the files app) whether the object exists. If the callback returns false, the collection itself is refused with NotFound('Entity does not exist or is not available'), HTTP 404 — no comment lookup happens.","triggerScenarios":"PROPFIND/POST/GET on /remote.php/dav/comments/files/<fileId> where <fileId> does not exist: the file was deleted, the id is wrong, or it belongs to another instance.","commonSituations":"Commenting on a file that was deleted between page load and submit; wrong file id after share or federation changes; hardcoded ids from a test environment used against production.","solutions":["Verify the file/object id exists and is visible to the user before addressing its comments.","Refetch the object id at comment time instead of caching it long-term.","Handle 404 on the collection as 'object gone' and clean up dependent client state."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!$objectExists($objectType, $objectId)) { // e.g. file id lookup before commenting\n    throw new ObjectGoneException($objectType . ' ' . $objectId . ' no longer exists');\n}\n$commentsUrl = '/remote.php/dav/comments/' . $objectType . '/' . $objectId . '/';","typeGuard":null,"tryCatchPattern":"try {\n    $client->propfind($commentsUrl, [], 1);\n} catch (NotFound $e) { // HTTP 404: the object itself is gone\n    removeObjectFromUi($objectId);\n}","preventionTips":["Resolve the object id right before commenting instead of caching it.","Handle collection-level 404 as 'object deleted' and clean up UI state.","Validate ids come from the same instance you query."],"tags":["dav","comments","files","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}