passbolt/passbolt_api · error · NotFoundException

The group does not exist or has been already deleted.

Error message

The group does not exist or has been already deleted.

What it means

Existence validation in GroupsDeleteController::_validateRequestData() (used by both dryRun and delete): the group id must resolve to an existing, non-deleted group before deletion can proceed. Fires when the id is well-formed but no live group matches (never existed or already deleted), returning HTTP 404; a malformed id raises a BadRequestException and insufficient rights a ForbiddenException earlier in the same method.

Solutions

  1. Verify the group exists and is not deleted
  2. Handle 404 as already deleted in the client
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/Controller/Groups/GroupsDeleteController.php:156 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at src/Controller/Groups/GroupsDeleteController.php:156

     * @throws \Cake\Http\Exception\NotFoundException if the group does not exist or is already deleted
     * @return \App\Model\Entity\Group $group entity
     */
    protected function _validateRequestData(string $id)
    {
        // Admin can delete all groups
        if ($this->User->role() !== Role::ADMIN) {
            if (!$this->GroupsUsers->isManager($this->User->id(), $id)) {
                throw new ForbiddenException(__('You are not authorized to access that location.'));
            }
        }
        if (!Validation::uuid($id)) {
            throw new BadRequestException(__('The group identifier should be a valid UUID.'));
        }

        /** @var \App\Model\Entity\Group $group */
        $group = $this->Groups->findView($id, ['contain' => ['groups_users' => true]])->first();
        if (empty($group)) {
            throw new NotFoundException(__('The group does not exist or has been already deleted.'));
        }

        return $group;
    }

    /**
     * Validate the delete operation
     *
     * @param \App\Model\Entity\Group $group The target group
     * @throws \App\Error\Exception\CustomValidationException if the group is sole owner of a shared resource
     * @return void
     */
    protected function _validateDelete(Group $group)
    {
        // Check business rules
        // Returning the validation error is not meaningful enough so we need to
        // build the proper answer with list of incriminated resources that needs transfer
        // of ownership if any

View on GitHub (pinned to 31c1bbc10f)