passbolt/passbolt_api · error · Cake\Http\Exception\NotFoundException

The resource does not exist.

Error message

The resource does not exist.

What it means

ResourcesAfterAccessRevokedService.getResource fetches the resource with the folderizable finder for the affected user; a RecordNotFoundException is converted into NotFoundException 'The resource does not exist.' It is raised while removing the resource from users' personal folder trees after access is revoked. Same shape as error 61 but on the revoke path.

Solutions

  1. Verify the resource id still exists before revoking access; refresh share data in the client.
  2. Treat this as benign in event-replay contexts: if the resource is gone, the tree entry is already gone — skip rather than retry.
  3. Check for concurrent delete/revoke races in the client workflow and serialize them.
  4. If it persists for an existing resource, inspect the user's permissions and FolderizableBehavior finder conditions.
Defensive patterns

Strategy: try-catch

Validate before calling

const exists = resources.some(r => r.id === resourceId);
if (!exists) return; // already gone, nothing to revoke

Try / catch

try { await revokeAccess(resourceId, aros); } catch (e) { if (e.response?.status === 404) return; // idempotent no-op
 throw e; }

Prevention

When it happens

Trigger: Revoking user/group access to a resource when the resource was deleted before the revoke event is processed, the id in the event is stale, or the folderizable finder excludes the resource for that user.

Common situations: Deleting a resource while a share-revoke is in flight; bulk group-permission changes referencing resources removed earlier; background jobs replaying old permission-change events.

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


AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17). Data as JSON: /api/errors/7891028c23d81144. Report an issue: GitHub.

Appendix: source

Thrown at plugins/PassboltCe/Folders/src/Service/Resources/ResourcesAfterAccessRevokedService.php:104

    /**
     * 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->Resources->get(
                $resourceId,
                finder: FolderizableBehavior::FINDER_NAME,
                user_id: $uac->getId()
            );
        } catch (RecordNotFoundException $e) {
            throw new NotFoundException(__('The resource does not exist.'));
        }
    }

    /**
     * Remove a resource from a group of users trees.
     *
     * @param \App\Model\Entity\Resource $resource The target resource
     * @param string $groupId The target group
     * @return void
     * @throws \Exception
     */
    private function removeResourceFromGroupUsersTrees(Resource $resource, string $groupId): void
    {
        $grousUsersIds = $this->GroupsUsers->findByGroupId($groupId)
            ->all()
            ->extract('user_id')
            ->toArray();
        foreach ($grousUsersIds as $groupUserId) {

View on GitHub (pinned to 31c1bbc10f)