passbolt/passbolt_api · error · Cake\Http\Exception\NotFoundException
The resource does not exist.
Error message
The resource does not exist.
What it means
ResourcesAfterAccessGrantedService.getResource fetches the resource with the folderizable finder scoped to the given user; if the table throws RecordNotFoundException it is rethrown as a NotFoundException 'The resource does not exist.' This happens while adding the resource to the newly-granted users' folder trees after share/access grant. It signals the resource id referenced in the access-grant event no longer resolves for that user.
Solutions
- Confirm the resource still exists (GET /resources/<id>) before sharing; refresh the UI if it was deleted.
- Check the resource is not filtered out for the target user (deleted flag / folder relations state).
- Retry the share operation with the current resource list if a concurrent-delete race is suspected.
- If reproducible without deletion, inspect FolderizableBehavior finder conditions and the user's permissions on the resource.
Defensive patterns
Strategy: try-catch
Validate before calling
const res = await fetch(`/resources/${resourceId}.json`);
if (!res.ok) throw new Error('Resource no longer exists; refresh before sharing'); Try / catch
try { await shareResource(id, acl); } catch (e) { if (e.response?.status === 404) { refreshResourceList(); notifyUser('Resource was deleted'); } else throw e; } Prevention
- Refresh resource data before opening share dialogs.
- Handle concurrent deletes by reloading lists after mutations.
- Avoid caching resource ids across long-running sessions.
- Treat 404 during share as a skip-and-continue in batch group operations.
When it happens
Trigger: Sharing a resource (granting group/user access) when the resource has been deleted concurrently, or the resource is soft-filtered out by FolderizableBehavior for that user, or the resource id in the event payload is invalid.
Common situations: Race condition: two users act on the same resource and one deletes it while the other shares it; stale share dialogs in the front-end referencing deleted resources; group edits re-triggering afterAccessGranted with outdated resource ids; folder personal-tree rebuild jobs processing removed resources.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- The folder does not exist.
- The resource does not exist.
- Could not validate folder data.
- The folder does not exist.
- The folder does not exist.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/9a3f1c78c1c4b731.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltCe/Folders/src/Service/Resources/ResourcesAfterAccessGrantedService.php:105
/**
* Retrieve the resource.
*
* @param \App\Utility\UserAccessControl $uac UserAccessControl updating the resource
* @param string $resourceId The resource identifier to retrieve.
* @return \App\Model\Entity\Resource
* @throws \Cake\Http\Exception\NotFoundException If the resource does not exist.
*/
private function getResource(UserAccessControl $uac, string $resourceId): Resource
{
try {
return $this->resourcesTable->get(
$resourceId,
finder: FolderizableBehavior::FINDER_NAME,
user_id: $uac->getId()
);
} catch (RecordNotFoundException $e) {
throw new NotFoundException(__('The resource does not exist.'));
}
}
/**
* Add a resource to a group of users trees.
*
* @param \App\Utility\UserAccessControl $uac The operator
* @param \App\Model\Entity\Resource $resource The target resource
* @param string $groupId The target group
* @return void
* @throws \Exception If something wrong occurred
*/
private function addResourceToGroupUsersTrees(UserAccessControl $uac, Resource $resource, string $groupId): void
{
$groupUsersIds = $this->findGroupsUsersIdsNotHavingFolderRelation($resource, $groupId);
foreach ($groupUsersIds as $groupUserId) {
$this->addResourceToUserTree($uac, $resource, $groupUserId);
}View on GitHub (pinned to 31c1bbc10f)