passbolt/passbolt_api · error · ValidationException

Could not validate group user data.

Error message

Could not validate group user data.

What it means

GroupsUsersUpdateService::handleValidationErrors throws this ValidationException when the patched GroupsUser entity fails table-level save validation. It wraps the entity and the table so the response includes per-field validation errors (e.g. is_admin, user_id, group_id).

Solutions

  1. Inspect the validation errors attached to the response body and fix the offending fields.
  2. Ensure is_admin is a boolean and the group user id exists (GET /groups/{id}).
  3. Send only schema fields (user_id, is_admin) with correct types.
  4. Re-fetch the entity before patching to avoid stale/deleted ids.

Example fix

// before
await passbolt.updateGroupUser(id, { is_admin: 'true' });
// after
await passbolt.updateGroupUser(id, { is_admin: true });
Defensive patterns

Strategy: try-catch

Validate before calling

if (typeof payload.is_admin !== 'boolean') throw new TypeError('is_admin must be boolean');

Try / catch

try { await updateGroupUser(id, payload); } catch (e) { console.error(e.body?.errors); /* per-field errors */ }

Prevention

When it happens

Trigger: PUT /groups/users/{id} with invalid data: is_admin not boolean, unknown group_user id, patching non-existent field, or save() failing on entity rules via patchGroupUserEntity or saveGroupUser.

Common situations: Sending is_admin as string 'true'/1 where strict validation rejects it, referencing a deleted group user, malformed request bodies, API clients not matching schema.

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/abcb2d2468c12206. Report an issue: GitHub.

Appendix: source

Thrown at src/Service/GroupsUsers/GroupsUsersUpdateService.php:134

    private function saveGroupUser(GroupsUser $groupUser): void
    {
        $this->groupsUsersTable->save($groupUser);
        if ($groupUser->hasErrors()) {
            $this->handleValidationErrors($groupUser);
        }
    }

    /**
     * Handle groups users validation errors.
     *
     * @param \App\Model\Entity\GroupsUser $groupUser The list of errors
     * @throws \App\Error\Exception\ValidationException If the provided data does not validate.
     * @return void
     */
    private function handleValidationErrors(GroupsUser $groupUser): void
    {
        $msg = __('Could not validate group user data.');
        throw new ValidationException($msg, $groupUser, $this->groupsUsersTable);
    }
}

View on GitHub (pinned to 31c1bbc10f)