passbolt/passbolt_api · error · App\Error\Exception\ValidationException
Could not validate folder data.
Error message
Could not validate folder data.
What it means
A ValidationException raised by FoldersUpdateService::handleValidationErrors when the folder entity has validation errors after attempting to update folder metadata (name, personal flag, etc.). The entity's getErrors() is non-empty, so the service throws with the entity and FoldersTable attached so clients receive the per-field error details.
Solutions
- Inspect the errors object in the 400 response to see which folder field failed and why.
- Provide a non-empty 'name' within the column length limit (max 255 chars).
- Only send editable fields (name, personal) with correct types: personal as boolean.
- Fetch the folder first and patch only the fields that must change.
Example fix
// before
PUT /folders/{id} {"name":""}
// after
PUT /folders/{id} {"name":"Quarterly Budget"} Defensive patterns
Strategy: validation
Validate before calling
function validateFolderMeta(data) {
const errors = {};
if (typeof data.name !== 'string' || data.name.trim() === '') errors.name = 'required';
if (data.name && data.name.length > 255) errors.name = 'max_length';
if ('personal' in data && typeof data.personal !== 'boolean') errors.personal = 'boolean';
return errors;
} Try / catch
try {
await foldersApi.update(folderId, meta);
} catch (e) {
if (e.response?.status === 400 && e.response.data?.errors) {
// map entity errors back to form fields
}
throw e;
} Prevention
- Enforce non-empty names and the 255-char limit in the client before submitting.
- Send only whitelisted fields (name, personal) with correct JSON types.
- Trim names to avoid whitespace-only values.
- Surface the errors payload from 400 responses directly to the user.
When it happens
Trigger: PUT /folders/{folderId} (FoldersUpdateService::updateFolderMeta) with data failing FoldersTable rules: empty name, name exceeding length limits, invalid 'personal' boolean type, or non-whitelisted fields passed in the payload.
Common situations: API clients sending an empty or whitespace name, names longer than the column size (255), sending 'personal' as a string instead of boolean, or including read-only fields in the request body.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Could not validate folder data.
- Could not validate folder data.
- Could not validate folder relation data.
- Could not validate folders relations history data.
- Could not validate move data.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/5903ba1b59f0e97a.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltCe/Folders/src/Service/Folders/FoldersUpdateService.php:174
'modified_by' => true,
'name' => true, // also required for v5 to clear out field
]);
return $this->foldersTable->patchEntity($folder, $data, $options);
}
/**
* Handle folder validation errors.
*
* @param \Passbolt\Folders\Model\Entity\Folder $folder The folder
* @return void
* @throws \App\Error\Exception\ValidationException If the provided data does not validate.
*/
private function handleValidationErrors(Folder $folder): void
{
$errors = $folder->getErrors();
if (!empty($errors)) {
throw new ValidationException(__('Could not validate folder data.'), $folder, $this->foldersTable);
}
}
}
View on GitHub (pinned to 31c1bbc10f)