passbolt/passbolt_api · error · FormValidationException
Could not validate the password policies settings.
Error message
Could not validate the password policies settings.
What it means
Thrown by PasswordPoliciesGetSettingsService::get() when the password policies settings loaded from file or environment fail validation against PasswordPoliciesSettingsForm. The service refuses to return settings that do not conform to the expected schema, so a broken or hand-edited config is surfaced instead of silently propagated.
Solutions
- Inspect the form errors: catch FormValidationException and read getErrors()/the form errors to see which fields failed.
- Fix the invalid values in the password policies settings file or environment variables and retry.
- Regenerate a valid settings file from a working installation or re-save settings via the admin UI.
- Verify the plugin/config version matches the running passbolt version after upgrades.
Defensive patterns
Strategy: validation
Validate before calling
$dto = $settingsDto->toArray();
$form = new PasswordPoliciesSettingsForm();
if (!$form->validate($dto)) {
error_log(print_r($form->getErrors(), true));
} Try / catch
try {
$settings = $service->get();
} catch (FormValidationException $e) {
$errors = $e->getForm()->getErrors();
// log/repair settings
} Prevention
- Never hand-edit the password policies config without validating against the form schema.
- Re-validate settings after passbolt upgrades.
- Use the admin UI to generate settings rather than writing files manually.
- Keep env overrides consistent with expected types (numeric/boolean).
When it happens
Trigger: Calling get() (e.g. via the password policies settings GET endpoint or import) when the settings file/env values are missing required keys, have wrong types, or contain out-of-range policy values.
Common situations: Operators hand-editing config/password-policies.php with invalid values (e.g. non-numeric entropy settings, malformed generator options), upgrading passbolt when the settings schema changed and old files no longer validate, or env-var overrides with bad values.
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
- " " is not a valid search filter.
- " " is not a valid search filter. It is not a UTF8 string.
- " " is not a valid search filter. It should be between 1…
- " " is not a valid user filter.
- " " is not a valid value for filter .
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/0fce1ac5c586fff8.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltCe/PasswordPolicies/src/Service/PasswordPoliciesGetSettingsService.php:38
use App\Error\Exception\FormValidationException;
use Cake\Core\Configure;
use Passbolt\PasswordGenerator\PasswordGeneratorPlugin;
use Passbolt\PasswordPolicies\Form\PasswordPoliciesSettingsForm;
use Passbolt\PasswordPolicies\Model\Dto\PasswordPoliciesSettingsDto;
use Passbolt\PasswordPolicies\PasswordPoliciesPlugin;
class PasswordPoliciesGetSettingsService implements PasswordPoliciesGetSettingsInterface
{
/**
* @inheritDoc
*/
public function get(): PasswordPoliciesSettingsDto
{
$passwordPoliciesSettingsDto = $this->getSettingsFromFileOrEnv();
$form = new PasswordPoliciesSettingsForm();
if (!$form->execute($passwordPoliciesSettingsDto->toArray())) {
throw new FormValidationException(__('Could not validate the password policies settings.'), $form);
}
return $passwordPoliciesSettingsDto;
}
/**
* Get password policies from file or environment variables.
*
* @return \Passbolt\PasswordPolicies\Model\Dto\PasswordPoliciesSettingsDto
*/
private function getSettingsFromFileOrEnv(): PasswordPoliciesSettingsDto
{
$settingsSource = $this->getSettingsSource();
$defaultPasswordGenerator = $this->getPasswordGeneratorFromSource($settingsSource);
$passwordPoliciesSettingsData = [
'source' => $settingsSource,
'default_generator' => $defaultPasswordGenerator,
];View on GitHub (pinned to 31c1bbc10f)