{"record":{"id":"1b444bc4e3fdf897","repo":"passbolt/passbolt_api","slug":"the-group-does-not-exist-groupgetservice","errorCode":null,"errorMessage":"The group does not exist.","messagePattern":"The group does not exist\\.","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"warning","filePath":"src/Service/Groups/GroupGetService.php","lineNumber":66,"sourceCode":"\n    /**\n     * Get a group by ID or throw relevant HTTP exception.\n     *\n     * @param string $groupId The identifier of the group to get\n     * @return \\App\\Model\\Entity\\Group\n     * @throws \\Cake\\Http\\Exception\\BadRequestException If the group identifier is not a valid UUID.\n     * @throws \\Cake\\Http\\Exception\\NotFoundException If the group does not exist.\n     */\n    protected function getOrFail(string $groupId): Group\n    {\n        if (!Validation::uuid($groupId)) {\n            throw new BadRequestException(__('The group identifier should be a valid UUID.'));\n        }\n\n        try {\n            $group = $this->groupsTable->get($groupId);\n        } catch (RecordNotFoundException $exception) {\n            throw new NotFoundException(__('The group does not exist.'));\n        }\n\n        return $group;\n    }\n\n    /**\n     * Get a group by ID or throw relevant HTTP exception.\n     *\n     * @param string $groupId The identifier of the group to get\n     * @return \\App\\Model\\Entity\\Group\n     * @throws \\Cake\\Http\\Exception\\NotFoundException If the group does not exist or is soft deleted\n     */\n    public function getNotDeletedOrFail(string $groupId): Group\n    {\n        $group = $this->getOrFail($groupId);\n        if ($group->deleted) {\n            throw new NotFoundException(__('The group does not exist.'));\n        }","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/src/Service/Groups/GroupGetService.php#L48-L84","documentation":"Existence check in GroupGetService::getOrFail() (reached via getNotDeletedOrFail): after the UUID format check, the service queries the Groups table by id and throws when no group entity is found. Fires when the group id references a nonexistent or deleted group, returning HTTP 404 so callers can surface 'group not found' to users.","triggerScenarios":"Requesting /groups/{id} (or updates/deletes) with a well-formed UUID that has no matching row, e.g. after the group was hard-deleted or the id never existed.","commonSituations":"Stale ids in client caches after group deletion, typos when copying ids, tests using fabricated UUIDs, cross-environment id reuse (staging id used in prod).","solutions":["Fetch current groups via GET /groups to obtain a valid id","Check whether the group was deleted in the admin UI","Treat 404 as terminal and refresh local group references"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\nif (!UUID_RE.test(groupId)) throw new Error('not a UUID');","typeGuard":null,"tryCatchPattern":"try {\n  const group = await api.get(`/groups/${groupId}`);\n} catch (e) {\n  if (e.response?.status === 404) {\n    await refreshGroupList(); // id never existed or group was removed\n    return null;\n  }\n  throw e;\n}","preventionTips":["Re-fetch group lists instead of caching ids long-term","Treat 404 as terminal and clear stale references","Confirm environment (staging vs prod) when ids mysteriously vanish"],"tags":["http-404","groups","rest-api"],"backgroundTag":"record-not-found","analyzedSha":"31c1bbc10f32808a607fa9bd81891e898779c0bc","analyzedAt":"2026-09-17T00:04:38.960Z","contentChangedAt":"2026-09-17T00:04:38.960Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}