{"record":{"id":"2577b0dc8b4d6ac5","repo":"passbolt/passbolt_api","slug":"the-group-identifier-should-be-a-valid-uuid-groupgetservice","errorCode":null,"errorMessage":"The group identifier should be a valid UUID.","messagePattern":"The group identifier should be a valid UUID\\.","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"warning","filePath":"src/Service/Groups/GroupGetService.php","lineNumber":60,"sourceCode":"     * GroupGetService constructor\n     */\n    public function __construct()\n    {\n        $this->groupsTable = TableRegistry::getTableLocator()->get('Groups');\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\\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     */","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/src/Service/Groups/GroupGetService.php#L42-L78","documentation":"UUID guard in GroupGetService::getOrFail() (reached via getNotDeletedOrFail): the groupId must be a valid UUID before any lookup. Fires when callers pass a malformed group identifier, rejecting with HTTP 400; a well-formed id for a missing group raises the subsequent NotFoundException instead.","triggerScenarios":"Calling any endpoint resolving a group by id (e.g. GET/PUT/DELETE /groups/{id}) where {id} is not a UUID — a name, slug, empty string, or malformed id.","commonSituations":"Client passing the group name instead of its id, truncated or URL-unescaped ids, older API clients that used string identifiers before UUIDs were enforced.","solutions":["Ensure the client uses the group's UUID from the API listing (/groups)","Validate id format client-side with a UUID regex before calling","URL-encode ids correctly and avoid manual string truncation"],"exampleFix":"// before\ndeleteGroup('finance-team');\n// after\ndeleteGroup('b5b5c8c0-1234-4c4c-8c8c-123456789abc');","handlingStrategy":"validation","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(`groupId must be a UUID, got: ${groupId}`);","typeGuard":"const isGroupUuid = (v: unknown): v is string =>\n  typeof v === 'string' && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(v);","tryCatchPattern":"try {\n  await api.get(`/groups/${groupId}`);\n} catch (e) {\n  if (e.response?.status === 400) throw new Error('Group id must be a valid UUID');\n  throw e;\n}","preventionTips":["Always source group ids from API responses, not names or slugs","Validate UUID format client-side before any group call","Guard against truncation when storing ids in logs/configs"],"tags":["http-400","groups","uuid","validation"],"backgroundTag":"invalid-identifier-format","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"}