passbolt/passbolt_api · error · ValidationException

Could not validate group data.

Error message

Could not validate group data.

What it means

GroupsUpdateService::handleValidationErrors() throws App\Error\Exception\ValidationException with this message whenever a Group entity fails validation during any part of a group update (metadata change, adding/updating/removing group users). The exception embeds the entity and table for detailed field errors.

Solutions

  1. Read the per-field errors in the API response and correct those fields
  2. Split large changesets into smaller PUT calls to isolate the failing change
  3. Re-fetch the group before updating to ensure a fresh state
  4. Validate that added users exist and are not already members
Defensive patterns

Strategy: validation

Validate before calling

const existing = await api.get(`/groups/${groupId}/users`);
if (existing.some(u => u.user.id === userIdToAdd)) throw new Error('user already in group');
if (!newName || newName.length < 1) throw new Error('group name required');

Try / catch

try {
  await api.put(`/groups/${groupId}`, changes);
} catch (e) {
  if (e.response?.body?.errors) {
    const fieldErrors = e.response.body.errors;
    // surface field-level errors to the user
  }
  throw e;
}

Prevention

When it happens

Trigger: PUT /groups/{id} where any sub-operation triggers entity errors: invalid name, adding a user already in the group or nonexistent, deleting a nonexistent group user, metadata updates violating rules.

Common situations: Bulk updates where one invalid sub-change poisons the entity; concurrent edits where group state changed; permission-driven updates that are silently ignored leading to invalid final state.

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


AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17). Data as JSON: /api/errors/ca2a0f41bdb6ba97. Report an issue: GitHub.

Appendix: source

Thrown at src/Service/Groups/GroupsUpdateService.php:204

        $metaData['modified_by'] = $uac->getId();
        $this->groupsTable->patchEntity($group, $metaData, $groupPatchOptions);
        $this->groupsTable->save($group);
        if ($group->hasErrors()) {
            $this->handleValidationErrors($group);
        }
    }

    /**
     * Handle group validation errors.
     *
     * @param \App\Model\Entity\Group $group The target group
     * @throws \App\Error\Exception\ValidationException If the group has errors.
     * @return void
     */
    private function handleValidationErrors(Group $group): void
    {
        $msg = __('Could not validate group data.');
        throw new ValidationException($msg, $group, $this->groupsTable);
    }

    /**
     * Add groups users.
     *
     * @note if the operator is not a group manager, requested additions will be ignored.
     * @param \App\Utility\UserAccessControl $uac The user at the origin of the operation
     * @param \App\Model\Entity\Group $group The group to update.
     * @param array $changes The list of group users changes.
     * @param array $secretsData The list of secrets to add.
     * @return \App\Model\Dto\EntitiesChangesDto Entities changes applied following the addition of users to groups
     * @throws \Exception If an unexpected error occurred.
     */
    private function addGroupsUsers(
        UserAccessControl $uac,
        Group $group,
        array $changes,
        array $secretsData

View on GitHub (pinned to 31c1bbc10f)