passbolt/passbolt_api · error · App\Error\Exception\CustomValidationException
The supplied email notification settings are not valid
Error message
The supplied email notification settings are not valid
What it means
A CustomValidationException thrown when EmailNotificationSettingsForm::validate() fails on the posted data. The payload reached the controller and passed role/JSON checks, but one or more fields did not satisfy the form's validation rules; the exception carries the per-field errors in its body.
Solutions
- Inspect the 'errors' payload of the CustomValidationException response to identify which fields failed.
- Send only known EmailNotificationSettingsForm field keys with boolean values (true/false or 0/1).
- Read the form's validation schema (EmailNotificationSettingsForm) to confirm exact field names before posting.
- Update client-side settings payload to match the current passbolt version's expected setting names.
Example fix
// before
{"send_admin_user_setup_complete": "yes", "unknown_setting": true}
// after
{"send_admin_user_setup_complete": true} Defensive patterns
Strategy: validation
Validate before calling
$form = new EmailNotificationSettingsForm();
$errors = $form->validate($data) ? [] : $form->getErrors();
if ($errors) {
// fix payload before calling the controller
return $errors;
} Type guard
function isBoolSettingValue($v): bool { return is_bool($v) || in_array($v, [0, 1, '0', '1', 'true', 'false'], true); } Try / catch
try {
$response = $client->postEmailNotificationOrgSettings($data);
} catch (CustomValidationException $e) {
$fieldErrors = $e->getErrors(); // inspect and correct the payload
} Prevention
- Mirror the exact field names from EmailNotificationSettingsForm in the client payload.
- Send only boolean-valued settings (true/false, 0/1).
- Validate the payload with the same form class on the client side before posting.
- Keep client payloads updated when upgrading passbolt since setting names can change.
When it happens
Trigger: POST to /email-notification-settings/org-settings with data keys that are not valid notification settings, or values that fail boolean/normalization validation after QueryStringComponent::normalizeBoolean (e.g. unknown setting names, non-boolean values for known settings).
Common situations: Typo in a setting key (e.g. 'sendAdminUserSetupCompleted' vs the exact form field name); sending strings like 'yes'/'no' instead of booleans; sending nested/expanded structures the flat form does not expect; API version changes renaming settings.
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 the settings.
- Could not validate settings.
- Could not validate the metadata key data.
- Could not validate the metadata key data.
- Could not validate the MFA policies settings.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/684a18cd3a4b9b80.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltCe/EmailNotificationSettings/src/Controller/NotificationOrgSettings/NotificationOrgSettingsPostController.php:85
if ($this->User->role() !== Role::ADMIN) {
throw new ForbiddenException(__('You are not allowed to access this location.'));
}
if (!$this->request->is('json')) {
throw new BadRequestException(__('This is not a valid Ajax/Json request.'));
}
$data = $this->request->getData();
foreach ($data as $key => $value) {
$data[$key] = QueryStringComponent::normalizeBoolean($value);
}
$form = new EmailNotificationSettingsForm();
if (!$form->validate($data)) {
$errors = $form->getErrors();
throw new CustomValidationException(__('The supplied email notification settings are not valid'), $errors);
}
$data = EmailNotificationSettingsForm::formatFormDataToOrgSettings($data);
return Hash::expand($data);
}
/**
* Format the . delimited keys to snake_case
*
* @param array<string, mixed> $data The data to Format
* @return array<string, mixed> the formatted array
*/
private function _formatForOutput(array $data): array
{
$output = [];
foreach ($data as $key => $value) {View on GitHub (pinned to 31c1bbc10f)