{"record":{"id":"50dd3705a36f8aa9","repo":"passbolt/passbolt_api","slug":"the-folder-identifier-should-be-a-valid-uuid","errorCode":null,"errorMessage":"The folder identifier should be a valid UUID.","messagePattern":"The folder identifier should be a valid UUID\\.","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"plugins/PassboltEe/AuditLog/src/Controller/FolderLogsController.php","lineNumber":46,"sourceCode":"     */\n    public function getModelName(): string\n    {\n        return 'Folders';\n    }\n\n    /**\n     * View action logs for a given folder.\n     *\n     * @param string|null $folderId folder id\n     * @return void\n     * @throws \\Cake\\Http\\Exception\\BadRequestException if the resource id has the wrong format\n     * @throws \\Cake\\Http\\Exception\\NotFoundException if the user cannot access the given folder, or if the folder does not exist\n     */\n    public function view(?string $folderId = null)\n    {\n        // Check request sanity\n        if (!Validation::uuid($folderId)) {\n            throw new BadRequestException(__('The folder identifier should be a valid UUID.'));\n        }\n\n        $this->viewByEntity(new FolderActionLogsFinder(), $folderId);\n    }\n}\n","sourceCodeStart":28,"sourceCodeEnd":52,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/AuditLog/src/Controller/FolderLogsController.php#L28-L52","documentation":"Thrown by the AuditLog EE plugin's FolderLogsController when the folderId path parameter is not a valid UUID. The controller validates request sanity before looking up folder action logs, and any non-UUID identifier is rejected as a bad request before any permission or existence checks.","triggerScenarios":"GET /folders/<folderId>/logs.json where folderId is null, empty, an integer id, a slug, or otherwise not a UUID.","commonSituations":"Client code using a local numeric id or name instead of the passbolt UUID; missing route parameter due to a broken URL template; hand-crafted API calls in scripts/tests; copy-paste truncating the UUID.","solutions":["Pass the folder's passbolt UUID (36-char, 8-4-4-4-12 format) in the URL path","Fetch the correct folder id via GET /folders.json and use its id field","Fix URL construction in client code — ensure the id segment is interpolated and non-empty","Validate the id client-side with a UUID regex or library before calling the endpoint"],"exampleFix":"// before\nawait fetch(`/folders/${folder.name}/logs.json`);\n// after\nawait fetch(`/folders/${folder.id}/logs.json`); // folder.id is a UUID","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(folderId)) throw new Error('folderId must be a UUID');","typeGuard":"const isUuid = (v) => 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  const logs = await getFolderLogs(folderId);\n} catch (e) {\n  if (e.code === 400 && /valid UUID/.test(e.message)) {\n    console.error('Bad folder id:', folderId);\n  } else { throw e; }\n}","preventionTips":["Always use the entity UUID returned by the API, never names or local ids","Validate UUID format client-side before building the URL","Guard URL templates so the id segment is never empty/undefined","Beware truncated UUIDs from copy-paste"],"tags":["audit-log","uuid","http-400","controller"],"backgroundTag":"invalid-argument-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"}