passbolt/passbolt_api · error · BadRequestException
The folder identifier should be a valid UUID.
Error message
The folder identifier should be a valid UUID.
What it means
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.
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
Example fix
// before
await fetch(`/folders/${folder.name}/logs.json`);
// after
await fetch(`/folders/${folder.id}/logs.json`); // folder.id is a UUID Defensive patterns
Strategy: validation
Validate before calling
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
if (!UUID_RE.test(folderId)) throw new Error('folderId must be a UUID'); Type guard
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); Try / catch
try {
const logs = await getFolderLogs(folderId);
} catch (e) {
if (e.code === 400 && /valid UUID/.test(e.message)) {
console.error('Bad folder id:', folderId);
} else { throw e; }
} Prevention
- 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
When it happens
Trigger: GET /folders/<folderId>/logs.json where folderId is null, empty, an integer id, a slug, or otherwise not a UUID.
Common situations: 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.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- The resource identifier should be a valid UUID.
- The user identifier should be a valid UUID.
- The comment id is not valid.
- The group id is not valid.
- The group identifier should be a valid UUID.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/50dd3705a36f8aa9.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltEe/AuditLog/src/Controller/FolderLogsController.php:46
*/
public function getModelName(): string
{
return 'Folders';
}
/**
* View action logs for a given folder.
*
* @param string|null $folderId folder id
* @return void
* @throws \Cake\Http\Exception\BadRequestException if the resource id has the wrong format
* @throws \Cake\Http\Exception\NotFoundException if the user cannot access the given folder, or if the folder does not exist
*/
public function view(?string $folderId = null)
{
// Check request sanity
if (!Validation::uuid($folderId)) {
throw new BadRequestException(__('The folder identifier should be a valid UUID.'));
}
$this->viewByEntity(new FolderActionLogsFinder(), $folderId);
}
}
View on GitHub (pinned to 31c1bbc10f)