passbolt/passbolt_api · error · FormValidationException
Could not validate the user passphrase policies settings.
Error message
Could not validate the user passphrase policies settings.
What it means
UserPassphrasePoliciesGetSettingsService::get validates the stored settings value against UserPassphrasePoliciesSettingsForm. If a settings record exists in organization settings but its stored value array fails the form's rules, it throws this FormValidationException carrying the form's error list.
Solutions
- Look at the form errors attached to the FormValidationException to see which fields are invalid.
- Re-save the settings with the current API (POST user passphrase policies settings) so the value is rewritten in the expected format.
- As a last resort remove the stale organization_settings record so the service falls back to createFromDefault().
Defensive patterns
Strategy: fallback
Try / catch
try { return $service->get(); } catch (FormValidationException $e) { return UserPassphrasePoliciesSettingsDto::createFromDefault(); } Prevention
- Re-save settings through the current API after version upgrades.
- Avoid direct DB edits to organization settings.
- Catch FormValidationException and fall back to default settings with an admin warning.
When it happens
Trigger: Reading user passphrase policies settings when the persisted value in organization_settings fails UserPassphrasePoliciesSettingsForm validation (e.g. invalid source, wrong types, missing/invalid fields such as length or entropy minimums).
Common situations: Settings saved by a different plugin/client version with an out-of-date schema; manually edited database rows; settings written by a newer passbolt version then read by an older one.
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 user passphrase policies settings.
- Could not retrieve the user passphrase policies.
- Could not validate the password expiry settings.
- Could not validate the password expiry settings.
- Could not validate the settings.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/cbc5e949c217435f.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltEe/UserPassphrasePolicies/src/Service/UserPassphrasePoliciesGetSettingsService.php:51
* @return \Passbolt\UserPassphrasePolicies\Model\Dto\UserPassphrasePoliciesSettingsDto
* @throws \App\Error\Exception\FormValidationException When settings could not validate
*/
public function get(): UserPassphrasePoliciesSettingsDto
{
/** @var \Passbolt\UserPassphrasePolicies\Model\Table\UserPassphrasePoliciesSettingsTable $userPassphrasePoliciesSettingsTable */
$userPassphrasePoliciesSettingsTable = $this->fetchTable('Passbolt/UserPassphrasePolicies.UserPassphrasePoliciesSettings'); // phpcs:ignore
/** @var \Passbolt\UserPassphrasePolicies\Model\Entity\UserPassphrasePoliciesSetting|null $userPassphrasePoliciesSetting */
$userPassphrasePoliciesSetting = $userPassphrasePoliciesSettingsTable->find()->first();
// Fallback to default settings if no data in database
if (is_null($userPassphrasePoliciesSetting)) {
return UserPassphrasePoliciesSettingsDto::createFromDefault();
}
$form = new UserPassphrasePoliciesSettingsForm();
if (!$form->execute($userPassphrasePoliciesSetting->value)) {
throw new FormValidationException(
__('Could not validate the user passphrase policies settings.'),
$form
);
}
return UserPassphrasePoliciesSettingsDto::createFromEntity($userPassphrasePoliciesSetting);
}
}
View on GitHub (pinned to 31c1bbc10f)