passbolt/passbolt_api · error · ValidationException

Could not validate group data.

Error message

Could not validate group data.

What it means

GroupsUpdateDryRunService::handleValidationErrors() throws App\Error\Exception\ValidationException with this message when a Group entity accumulated errors during the dry-run save. The exception carries the entity and table so the API can report per-field errors.

Solutions

  1. Inspect the errors object in the response for the exact failing fields
  2. Fix the offending fields (e.g. choose a unique group name)
  3. Re-fetch group state before resubmitting to avoid stale changesets
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-checks before dry-run update
const names = (await api.get('/groups')).map(g => g.name);
if (names.includes(newName)) throw new Error('group name already taken');
if (!newMembers.every(u => existingUserIds.has(u.id))) throw new Error('unknown user in changeset');

Try / catch

try {
  await api.post(`/groups/${id}/dry-run`, changes);
} catch (e) {
  if (e.response?.body?.errors || e.response?.data?.errors) {
    console.error('Dry-run validation errors:', e.response.body.errors);
  }
  throw e;
}

Prevention

When it happens

Trigger: During a dry-run group update (e.g. adding/removing group users in simulation mode) when entity save fails validation — invalid group name, invalid user modifications, rules like unique name failing.

Common situations: Renaming a group to a name that already exists; submitting changesets referencing users already in the group or nonexistent; seeding API payloads from outdated group 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/783d114637d35b6a. Report an issue: GitHub.

Appendix: source

Thrown at src/Service/Groups/GroupsUpdateDryRunService.php:138

            if (!empty($errors)) {
                $group->setError('groups_users', [$rowIndexRef => $errors]);
                $this->handleValidationErrors($group);
            }
        }
    }

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

    /**
     * Get the secrets that will require to be encrypted for the users added to the group.
     *
     * @param \App\Model\Entity\Group $group The group to update.
     * @param array $changes The list of group users changes.
     * @return array A list of secrets to request to the client
     * [
     *   [
     *     'resource_id' => uuid,
     *     'user_id' => uuid
     *   ],
     *   ...
     * ]
     */
    private function getAddedGroupsUsersMissingSecrets(Group $group, array $changes = []): array

View on GitHub (pinned to 31c1bbc10f)