passbolt/passbolt_api · error · App\Error\Exception\CustomValidationException
Could not validate move data.
Error message
Could not validate move data.
What it means
handleValidationErrors() collects validation errors gathered while resolving/validating the folder parent id in getAndValidateFolderParentId() and throws a CustomValidationException with the message 'Could not validate move data.' plus the error details attached to the Passbolt/Folders.FoldersRelations table. It signals the move payload failed domain validation.
Solutions
- Inspect the errors collection in the exception response (fields under the FoldersRelations table) to see which field failed.
- Ensure `folder_parent_id` is a valid UUID of an existing folder the user can use, or null (root) if moving to root is intended.
- Never set folder_parent_id to the id of the folder being moved (no self-parenting).
Example fix
// before
move(folderId, 'Folder', childId, {folder_parent_id: folderId}); // self-parent
// after
const parentId = folderId === targetParentId ? null : targetParentId;
move(folderId, 'Folder', childId, {folder_parent_id: parentId}); Defensive patterns
Strategy: try-catch
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 (folderParentId !== null && (folderParentId === folderId || !UUID_RE.test(folderParentId))) {
throw new Error('folder_parent_id must be null or a UUID different from the folder being moved');
} Try / catch
try {
await move(folderId, foreignModel, foreignId, {folder_parent_id: parentId});
} catch (e) {
if (e.response?.status === 400 && /Could not validate move data/.test(e.response?.data?.message ?? '')) {
const errors = e.response?.data?.errors ?? {};
// surface per-field errors from the FoldersRelations table to the user
}
throw e;
} Prevention
- Never send the moved folder's own id as folder_parent_id (no self-parenting).
- Verify the target parent folder exists and is accessible before moving.
- Parse and display the per-field errors object returned with the exception instead of ignoring it.
- Add UI-side checks preventing dropping a folder into itself or its descendants.
When it happens
Trigger: Calling the folder move endpoint where the parent id checks fail: `folder_parent_id` not a valid UUID, equal to the folder being moved (moving folder into itself), missing, or referencing an invalid/non-existent parent — any non-empty $errors array from getAndValidateFolderParentId.
Common situations: Client sending folder_parent_id pointing to the same folder, sending a parent id of a folder the user has no access to (surfaced as validation error), or omitting folder_parent_id when it is required.
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 move data.
- Could not validate folder data.
- Could not validate folder data.
- Could not validate folder data.
- Could not validate folders relations history data.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/dba79ff5388f7dbf.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltCe/Folders/src/Controller/FoldersRelations/FoldersRelationsMoveController.php:95
$errors = ['folder_parent_id' => ['uuid' => __('The folder parent identifier should be a valid UUID.')]];
$this->handleValidationErrors($errors);
}
return $folderParentId;
}
/**
* Handle folder validation errors.
*
* @param array $errors The errors
* @return void
* @throws \App\Error\Exception\CustomValidationException If errors
*/
private function handleValidationErrors(array $errors)
{
if (!empty($errors)) {
$foldersRelationsTable = TableRegistry::getTableLocator()->get('Passbolt/Folders.FoldersRelations');
throw new CustomValidationException(__('Could not validate move data.'), $errors, $foldersRelationsTable);
}
}
}
View on GitHub (pinned to 31c1bbc10f)